bug/wiremock-1268 moving Scenario state change before global response delay (#1436)

Co-authored-by: Stef Heyenrath <Stef.Heyenrath@gmail.com>
This commit is contained in:
Jayaraman VenkatesanandStef Heyenrath authored and GitHub committed 2026-04-03 10:51:24 +02:00
1 parent a453e00fdb
commit 479bb0b8ec
2 files changed
+123 -6

No files matched your search

@@ -122,6 +122,14 @@ internal class WireMockMiddleware(
}
}
// Transition scenario state immediately after matching, before any delay (global or
// per-mapping) so that concurrent retries arriving during a delay period see the
// updated state and match the correct next mapping instead of re-matching this one.
if (targetMapping.Scenario != null)
{
UpdateScenarioState(targetMapping);
}
if (!targetMapping.IsAdminInterface && options.RequestProcessingDelay > TimeSpan.Zero)
{
await Task.Delay(options.RequestProcessingDelay.Value).ConfigureAwait(false);
@@ -147,11 +155,6 @@ internal class WireMockMiddleware(
}
}
if (targetMapping.Scenario != null)
{
UpdateScenarioState(targetMapping);
}
if (!targetMapping.IsAdminInterface && targetMapping.Webhooks?.Length > 0)
{
await SendToWebhooksAsync(targetMapping, request, response).ConfigureAwait(false);