don't allow extract option to break jsonp

This commit is contained in:
Leo Horie 2015-04-24 15:55:11 -04:00
parent 2177fbd446
commit 0870839e90

View file

@ -1113,7 +1113,7 @@ var m = (function app(window, undefined) {
var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp"; var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp";
var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify; var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify;
var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse; var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse;
var extract = xhrOptions.extract || function(xhr) { var extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) {
return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText
}; };
xhrOptions.method = (xhrOptions.method || 'GET').toUpperCase(); xhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();