From dac75ecd6ea1e85fb3bbd61909a0ceb90a572bfc Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:10:19 -0800 Subject: [PATCH] try adding exact chunklength on last chunk, instead of using generic length. does this help? --- .../Azure.Sdk.Tools.TestProxy/RecordingHandler.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs index bfe27e65823..966e3c21cb7 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs @@ -488,8 +488,9 @@ public byte[][] GetBatches(byte[] bodyData, int batchCount) for(int i = 0; i < batches.Length; i++) { - var batch = new byte[chunkLength]; - Array.Copy(bodyData, i * chunkLength, batch, 0, i == batches.Length - 1 && batches.Length > 1 && remainder > 0 ? remainder : chunkLength); + var calculatedChunkLength = i == batches.Length - 1 && batches.Length > 1 && remainder > 0 ? remainder : chunkLength; + var batch = new byte[calculatedChunkLength]; + Array.Copy(bodyData, i * chunkLength, batch, 0, calculatedChunkLength); batches[i] = batch; } @@ -515,6 +516,10 @@ public async Task WriteBodyBytes(byte[] bodyData, int playbackResponseTime, Http { Thread.Sleep(sleepLength); } + else + { + await outgoingResponse.Body.FlushAsync().ConfigureAwait(false); + } } } else