diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs index a0414ef9441..8cd39ca831b 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs @@ -118,5 +118,15 @@ public void Sanitize(RecordedTestSanitizer sanitizer) sanitizer.Sanitize(this); } } + public void Sanitize(IEnumerable sanitizers) + { + lock (Entries) + { + foreach(var sanitizer in sanitizers) + { + sanitizer.Sanitize(this); + } + } + } } } diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs index 7690acf82cf..04e6f55bfb7 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs @@ -114,11 +114,7 @@ public void StopRecording(string sessionId, IDictionary variable } var sanitizers = SanitizerRegistry.GetSanitizers(recordingSession); - - foreach (RecordedTestSanitizer sanitizer in sanitizers) - { - recordingSession.Session.Sanitize(sanitizer); - } + recordingSession.Session.Sanitize(sanitizers); if (variables != null) { @@ -464,11 +460,7 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming { if (!session.IsSanitized) { - foreach (RecordedTestSanitizer sanitizer in sanitizers) - { - session.Session.Sanitize(sanitizer); - } - + session.Session.Sanitize(sanitizers); session.IsSanitized = true; } }