Skip to content

Commit

Permalink
Improved content-type detection in DefaultErrorHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Aug 26, 2020
1 parent 4920dd6 commit 4779f90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/TypedRest/Errors/DefaultErrorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public async Task HandleAsync(HttpResponseMessage response)

private static string? ExtractJsonMessage(HttpResponseMessage response, string body)
{
if (response.Content.Headers.ContentType?.MediaType == "application/json")
string? mediaType = response.Content.Headers.ContentType?.MediaType;
if (mediaType == "application/json" || (mediaType != null && mediaType.EndsWith("+json")))
{
try
{
Expand Down

0 comments on commit 4779f90

Please sign in to comment.