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

Commit 14443dc

Browse files
committed
Only load into buffer if content present
1 parent 7286ee5 commit 14443dc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

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

102102
try
103103
{
104-
// Buffer content for further processing
105-
await response.Content.LoadIntoBufferAsync();
104+
if (response.Content != null)
105+
// Buffer content for further processing
106+
await response.Content.LoadIntoBufferAsync();
107+
else
108+
process = false;
106109
}
107110
catch (Exception ex)
108111
{
@@ -184,4 +187,4 @@ private async Task DecompressRequest(HttpRequestMessage request)
184187
}
185188
}
186189
}
187-
}
190+
}

0 commit comments

Comments
 (0)