diff --git a/bower.json b/bower.json index 7c5347f..f5de3bd 100644 --- a/bower.json +++ b/bower.json @@ -2,9 +2,9 @@ "name": "core-ajax", "private": true, "dependencies": { - "polymer": "Polymer/polymer#master" + "polymer": "Polymer/polymer#^0.5.5" }, "devDependencies": { "polymer-test-tools": "Polymer/polymer-test-tools#master" } -} \ No newline at end of file +} diff --git a/core-xhr.html b/core-xhr.html index ea22804..897769d 100644 --- a/core-xhr.html +++ b/core-xhr.html @@ -58,7 +58,7 @@ // xhr.open(method, url, async); if (options.responseType) { - xhr.responseType = options.responseType; + xhr.responseType = xhr._responseType = options.responseType; } if (options.withCredentials) { xhr.withCredentials = true; @@ -71,7 +71,7 @@ } return xhr; }, - + toQueryString: function(params) { var r = []; for (var n in params) { @@ -85,7 +85,7 @@ isBodyMethod: function(method) { return this.bodyMethods[(method || '').toUpperCase()]; }, - + bodyMethods: { POST: 1, PUT: 1, @@ -96,7 +96,7 @@ makeReadyStateHandler: function(xhr, callback) { xhr.onreadystatechange = function() { if (xhr.readyState == 4) { - callback && callback.call(null, xhr.response, xhr); + callback && callback.call(null, !xhr.responseType && xhr._responseType == 'json' ? JSON.parse(xhr.response) : xhr.response, xhr); } }; }, @@ -112,5 +112,5 @@ }); - +