Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeharder committed Jul 26, 2024
1 parent a4e79aa commit 85384d4
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,18 +506,19 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming

Interlocked.Increment(ref Startup.RequestsPlayedBack);

// Only remove session once body has been written, to minimize probability client retries but test-proxy has already removed the session
var remove = true;

// If request contains "x-recording-remove: false", then request is not removed from session after playback.
// Used by perf tests to play back the same request multiple times.
var remove = true;
if (incomingRequest.Headers.TryGetValue("x-recording-remove", out var removeHeader))
{
remove = bool.Parse(removeHeader);
}

// Only remove session once body has been written, to minimize probability client retries but test-proxy has already removed the session
if (remove)
{
session.Session.Lookup(entry, session.CustomMatcher ?? Matcher, sanitizer, remove: true);
session.Session.Lookup(entry, session.CustomMatcher ?? Matcher, sanitizers, remove: true);
}
}

Expand Down

0 comments on commit 85384d4

Please sign in to comment.