aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/httpBackend.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js
index 11e1b999..842fd0cf 100644
--- a/src/ng/httpBackend.js
+++ b/src/ng/httpBackend.js
@@ -106,8 +106,21 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
xhr.withCredentials = true;
}
- if (responseType) {
- xhr.responseType = responseType;
+ if (responseType && isString(xhr.responseType)) {
+ try {
+ xhr.responseType = responseType;
+ } catch (e) {
+ // WebKit added support for the json responseType value on 09/03/2013
+ // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+ // known to throw when setting the value "json" as the response type. Other older
+ // browsers implementing the responseType
+ //
+ // The json response type can be ignored if not supported, because JSON payloads are
+ // parsed on the client-side regardless.
+ if (responseType !== 'json') {
+ throw e;
+ }
+ }
}
xhr.send(post || null);