Skip to content

Commit

Permalink
Ensure withCredentials is set after open for IE10
Browse files Browse the repository at this point in the history
  • Loading branch information
bluespore committed Feb 6, 2017
1 parent 6ce4773 commit d2791bd
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 @@ -242,10 +238,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 d2791bd

Please sign in to comment.