Skip to content

Commit

Permalink
fix(ajax): will set withCredentials after open on XHR for IE10 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bluespore authored and benlesh committed Feb 16, 2017
1 parent 375ce3e commit 0ab1d3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/observable/dom/AjaxObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ export interface AjaxRequest {

function getCORSRequest(this: AjaxRequest): XMLHttpRequest {
if (root.XMLHttpRequest) {
const xhr = new root.XMLHttpRequest();
if ('withCredentials' in xhr) {
xhr.withCredentials = !!this.withCredentials;
}
return xhr;
return new root.XMLHttpRequest();
} else if (!!root.XDomainRequest) {
return new root.XDomainRequest();
} else {
Expand Down Expand Up @@ -248,10 +244,14 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
return null;
}

// timeout and responseType can be set once the XHR is open
// timeout, responseType and withCredentials can be set once the XHR is open
xhr.timeout = request.timeout;
xhr.responseType = request.responseType;

if ('withCredentials' in xhr) {
xhr.withCredentials = !!request.withCredentials;
}

// set headers
this.setHeaders(xhr, headers);

Expand Down

0 comments on commit 0ab1d3b

Please sign in to comment.