Skip to content

Commit

Permalink
[RESTEASY-2155] Ignore charset when checking the content type (#1846)
Browse files Browse the repository at this point in the history
Some reverse proxies add a charset specification after the content-type: e.g. `application/json;charset=utf-8`. This needs to be recognized as application/json as well.
  • Loading branch information
ctalau authored and asoldano committed Feb 12, 2019
1 parent 382b88f commit 73f772a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resteasy-jsapi/src/main/resources/resteasy-client.js
Expand Up @@ -277,13 +277,15 @@ REST._complete = function(request, callback){
}

REST._isXMLMIME = function(contentType){
contentType = contentType.split(";", 1)[0];
return contentType == "text/xml"
|| contentType == "application/xml"
|| (contentType.indexOf("application/") == 0
&& contentType.lastIndexOf("+xml") == (contentType.length - 4));
}

REST._isJSONMIME = function(contentType){
contentType = contentType.split(";", 1)[0];
return contentType == "application/json"
|| (contentType.indexOf("application/") == 0
&& contentType.lastIndexOf("+json") == (contentType.length - 5));
Expand Down

0 comments on commit 73f772a

Please sign in to comment.