1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Revert b198927; always attempt to parse JSON

This way if there is a PHP error which outputs a 200 OK text/html response, Flarum will correctly show an error message.
This commit is contained in:
Toby Zerner
2015-10-31 14:49:14 +10:30
parent 7e3268be4c
commit ef9e438981

View File

@@ -227,12 +227,10 @@ export default class App {
throw new RequestError(status, responseText, options, xhr);
}
if (xhr.getResponseHeader('content-type').indexOf('json') !== -1) {
try {
return JSON.parse(responseText);
} catch (e) {
throw new RequestError(500, responseText, options, xhr);
}
try {
return JSON.parse(responseText);
} catch (e) {
throw new RequestError(500, responseText, options, xhr);
}
};