http clients that dont throw on error

c#, dotnet-httpclient

Solution

All the `System.Net.Http.HTTPClient` methods that return `Task<HttpResponseMessage>` do NOT throw on any HttpStatusCode. They only throw on timeouts, cancellations or inability to connect to a gateway.

Problem

I am looking for c# HTTP client that doesn't throw when it gets an HTTP error (404 for example). This is not just a style issue; its perfectly valid for a non 2xx reply to have a body but I cant get at it if the HTTP stack throws when doing a GetResponse()

Original source

Related problems