I'm using the HttpRequestMessage and HttpResponseMessage to obtain results from an API. For fault handling I would like to wrap it in a Success or Failure. The results come back from Task What is a good way to do this?
CodePudding user response:
The HttpResponseMessage model has a property called IsSuccessStatusCode
which if true
, indicates the HTTP response was successful (status codes 200-299).
You can write your own wrapper around HttpResponseMessage but why?
You don't need a wrapper in this case if all you need is a way to know if the response has succeeded or not.