From 119d1721e09c3796549376d80b3259c5f5bbf294 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 31 Oct 2015 14:49:14 +1030 Subject: [PATCH] Revert e1315d2; 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. --- js/lib/App.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/lib/App.js b/js/lib/App.js index b75523df2..03b74f3f0 100644 --- a/js/lib/App.js +++ b/js/lib/App.js @@ -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); } };