From bba13d8460bf6c79a6292fee4808d4049e16117b Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Thu, 7 Apr 2016 01:02:46 -0700 Subject: [PATCH] fix(AjaxObservable): support json responseType on IE - IE does not support json responseType, internally parse it into JSON object closes #1381 --- src/observable/dom/AjaxObservable.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/observable/dom/AjaxObservable.ts b/src/observable/dom/AjaxObservable.ts index 204f76b7eb..f3d662e92e 100644 --- a/src/observable/dom/AjaxObservable.ts +++ b/src/observable/dom/AjaxObservable.ts @@ -375,11 +375,13 @@ export class AjaxResponse { constructor(public originalEvent: Event, public xhr: XMLHttpRequest, public request: AjaxRequest) { this.status = xhr.status; - this.responseType = xhr.responseType; + this.responseType = xhr.responseType || request.responseType; + switch (this.responseType) { case 'json': if ('response' in xhr) { - this.response = xhr.response; + //IE does not support json as responseType, parse it internally + this.response = xhr.responseType ? xhr.response : JSON.parse(xhr.response || xhr.responseText || ''); } else { this.response = JSON.parse(xhr.responseText || ''); }