Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit 7286ee5

Browse files
committed
Only try buffer content if present
1 parent 1741b0d commit 7286ee5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Microsoft.AspNet.WebApi.MessageHandlers.Compression/ClientCompressionHandler.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
9999

100100
try
101101
{
102-
// Buffer content for further processing
103-
await response.Content.LoadIntoBufferAsync();
102+
if (response.Content != null)
103+
// Buffer content for further processing
104+
await response.Content.LoadIntoBufferAsync();
105+
else
106+
process = false;
104107
}
105108
catch (Exception ex)
106109
{
@@ -184,4 +187,4 @@ private async Task DecompressResponse(HttpResponseMessage response)
184187
}
185188
}
186189
}
187-
}
190+
}

0 commit comments

Comments
 (0)