From 9b78627acf5e6c29dcc683b9a68aab814d4db495 Mon Sep 17 00:00:00 2001 From: Dave Keen <dev@ruffness.com> Date: Mon, 15 Jun 2015 14:31:43 +0200 Subject: [PATCH] If the filename ends with .json assume the loaded data is json, even if the accept header is wrong. --- src/ajax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index 9ba1e2c..5af7d44 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -128,8 +128,8 @@ function ajax(/*...args*/) { function success(req) { var res = req.target || req - , body = res.responseText - if(contentTypes.json.test(res.getResponseHeader('content-type'))) { + , body = res.responseText; + if(contentTypes.json.test(res.getResponseHeader('content-type')) || url.substr(url.length - 5) === '.json') { body = JSON.parse(body) } res.body = body