Skip to content

Commit

Permalink
Fixing null ref in Http when logging GET requests
Browse files Browse the repository at this point in the history
Resolves #95
  • Loading branch information
soxtoby committed Nov 5, 2021
1 parent dc17fb2 commit 07a8c46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SlackNet/Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public async Task<T> Execute<T>(HttpRequestMessage requestMessage, CancellationT
{
HttpResponseMessage response;

var requestLog = _log.WithContext("RequestBody", await requestMessage.Content.ReadAsStringAsync().ConfigureAwait(false));
var requestLog = requestMessage.Content is null
? _log
: _log.WithContext("RequestBody", await requestMessage.Content.ReadAsStringAsync().ConfigureAwait(false));

try
{
Expand Down

0 comments on commit 07a8c46

Please sign in to comment.