From 980d20ab62b08184ae012d07dedacc2ce1bfb6bc Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 8 May 2024 15:03:19 -0700 Subject: [PATCH] fix multiple sanitizers registering to a single recording --- tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs index 6b0bdf89b09..1705e9e1c99 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Admin.cs @@ -180,7 +180,6 @@ public async Task AddSanitizers() { var registeredId = _recordingHandler.RegisterSanitizer(sanitizer, recordingId); registeredSanitizers.Add(registeredId); - Response.Headers.Add("x-recording-id", recordingId); } else { @@ -188,6 +187,12 @@ public async Task AddSanitizers() registeredSanitizers.Add(registeredId); } } + + if (recordingId != null) + { + Response.Headers.Add("x-recording-id", recordingId); + } + var json = JsonSerializer.Serialize(new { Sanitizers = registeredSanitizers }); Response.ContentType = "application/json"; Response.ContentLength = json.Length;