Skip to content

Commit

Permalink
Using local variable to avoid null ref
Browse files Browse the repository at this point in the history
  • Loading branch information
KKhurin committed Mar 23, 2018
1 parent a998449 commit bd0826b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ public async Task SendRequestAsync(Message message, TimeoutHelper timeoutHelper)

if (!suppressEntityBody)
{
_httpRequestMessage.Content = MessageContent.Create(_factory, request, _timeoutHelper);
httpRequestMessage.Content = MessageContent.Create(_factory, request, _timeoutHelper);
}

try
Expand All @@ -1018,13 +1018,13 @@ public async Task SendRequestAsync(Message message, TimeoutHelper timeoutHelper)
{
using (timeoutToken.Register(s_cancelCts, _httpSendCts))
{
_httpResponseMessage = await _httpClient.SendAsync(_httpRequestMessage, HttpCompletionOption.ResponseHeadersRead, _httpSendCts.Token);
_httpResponseMessage = await _httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead, _httpSendCts.Token);
}

// As we have the response message and no exceptions have been thrown, the request message has completed it's job.
// Calling Dispose() on the request message to free up resources in HttpContent, but keeping the object around
// as we can still query properties once dispose'd.
_httpRequestMessage.Dispose();
httpRequestMessage.Dispose();
success = true;
}
catch (HttpRequestException requestException)
Expand Down

0 comments on commit bd0826b

Please sign in to comment.