diff --git a/src/http/httpClient/Middleware/BodyInspectionHandler.cs b/src/http/httpClient/Middleware/BodyInspectionHandler.cs index 3b6656a..03f5004 100644 --- a/src/http/httpClient/Middleware/BodyInspectionHandler.cs +++ b/src/http/httpClient/Middleware/BodyInspectionHandler.cs @@ -85,9 +85,18 @@ CancellationToken cancellationToken return null; } + if (httpContent.Headers.ContentLength == 0) + { + return Stream.Null; + } + var stream = new MemoryStream(); await httpContent.CopyToAsync(stream); - stream.Position = 0; + + if (stream.CanSeek) + { + stream.Position = 0; + } return stream; }