On my router, the response header Content-Type is
`application/json; charset=UTF-8` instead of `application/json`, so
almost every feature is broken.
Fixes: #2851
Suggested-by: zhanhb <6323014+zhanhb@users.noreply.github.com>
[reword commit subject]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{
if (xhr.readyState == 4) {
var json = null;
- if (xhr.getResponseHeader("Content-Type") == "application/json") {
+ if (/^application\/json\b/.test(xhr.getResponseHeader("Content-Type"))) {
try { json = JSON.parse(xhr.responseText); }
catch(e) { json = null; }
}