Class HttpExtensions
Provides a set of static methods related to HTTP.
public static class HttpExtensions
- Inheritance
-
HttpExtensions
- Inherited Members
Methods
EnsureNonErrorStatusCode(HttpResponseMessage, bool, bool)
Throws an exception if the HTTP response has an unaccepted error status code.
public static HttpResponseMessage EnsureNonErrorStatusCode(this HttpResponseMessage response, bool acceptsClientError = false, bool acceptsServerError = false)
Parameters
responseHttpResponseMessage- The response message.
acceptsClientErrorbool- Whether to accept responses with a client error status code (400~499).
acceptsServerErrorbool- Whether to accept responses with a server error status code (500~599).
Returns
- HttpResponseMessage
- The response message if there is no unaccepted error.
Exceptions
- HttpResponseStatusException
- The response has an unaccepted error status code.