Untitled

 avatar
unknown
plain_text
a year ago
523 B
3
Indexable
private static HttpRequestException CreateResponseException(HttpResponseMessage response, string responseContent)
{
    switch (response.StatusCode)
    {
        case HttpStatusCode.InternalServerError:
            var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(responseContent);
            return new HttpRequestException(problemDetails.Title, null, response.StatusCode);

        default:
            return new HttpRequestException(response.ReasonPhrase, null, response.StatusCode);
    }
}
Editor is loading...
Leave a Comment