There are several cases where RESTFulSense doesn't yet implement a functionality that HttpClient already offers.
Here are some examples:
PATCH
FORM
HEAD
OPTIONS
amongst many others.
This implementation enables any http call to be passed onto a ExecuteCallAsync function that validates the HttpResponseMessage and throws a proper exception if found.
Here's an example:
var httpClient = new HttpClient();
httpClient.BaseAddress =
httpClient.BaseAddress = new Uri("hassanhabib.com");
HttpMessageResponse =
await this.restfulApiClient.ExecuteHttpCallAsync(
httpClient.GetAsync("/tests"));
The above ExecuteHttpCallAsync will take care of handling any HttpResponseException and convert the response if erroneous into a meaningful exception like HttpBadRequestException and so on.
There are several cases where RESTFulSense doesn't yet implement a functionality that
HttpClient
already offers. Here are some examples:amongst many others.
This implementation enables any http call to be passed onto a
ExecuteCallAsync
function that validates theHttpResponseMessage
and throws a proper exception if found.Here's an example:
The above
ExecuteHttpCallAsync
will take care of handling anyHttpResponseException
and convert the response if erroneous into a meaningful exception likeHttpBadRequestException
and so on.