Demystifying HttpClient Internals: HttpResponseMessage A look at the internals of HttpResponseMessage

In the previous post in my demystifying HttpClient series, I looked at the internals of HttpRequestMessage. I want to continue the series by investigating the HttpResponseMessage. This class is mostly a property holder, with little internal logic but there are a few behaviours and best practices to watch out for. If you’ve read my previous […]

Read More

Demystifying HttpClient Internals: HttpRequestMessage A look at the internals of HttpRequestMessage

Anyone who regularly works with HttpClient will have likely have also used the HttpRequestMessage class. While HttpClient supports some convenience methods for quick actions such as sending a GET request; once you have more complex requirements, such a needing to include headers on the request, you will need to use HttpClient.SendAsync which accepts a HttpRequestMessage. […]

Read More

HttpClient Creation and Disposal Internals: Should I Dispose of HttpClient? .NET Core Internals - Under the Hood of HttpClient and HttpClientFactory

A common question that I get asked quite often and a point of reasonable confusion for developers is “Should I dispose of HttpClient or not?” There isn’t one yes or no answer to this. It really does depend on a few key factors. In this post, I’ll try to answer this question with enough code snippets […]

Read More

HttpClientFactory in ASP.NET Core 2.1 (Part 5): Logging Exploring the default request and response logging and how to replace the logging implementation

In the 2.1 release of IHttpClientFactory, the ASP.NET team included some built-in logging of the HTTP calls made via HttpClients created by the factory. This can be useful for the diagnosis of failures, as well as to understand the time taken to complete HTTP calls to external services.  In this post, I want to explore […]

Read More