Skip to content

Commit 0ab1d3b

Browse files
bluesporebenlesh
authored andcommitted
fix(ajax): will set withCredentials after open on XHR for IE10 (#2332)
1 parent 375ce3e commit 0ab1d3b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/observable/dom/AjaxObservable.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ export interface AjaxRequest {
2525

2626
function getCORSRequest(this: AjaxRequest): XMLHttpRequest {
2727
if (root.XMLHttpRequest) {
28-
const xhr = new root.XMLHttpRequest();
29-
if ('withCredentials' in xhr) {
30-
xhr.withCredentials = !!this.withCredentials;
31-
}
32-
return xhr;
28+
return new root.XMLHttpRequest();
3329
} else if (!!root.XDomainRequest) {
3430
return new root.XDomainRequest();
3531
} else {
@@ -248,10 +244,14 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
248244
return null;
249245
}
250246

251-
// timeout and responseType can be set once the XHR is open
247+
// timeout, responseType and withCredentials can be set once the XHR is open
252248
xhr.timeout = request.timeout;
253249
xhr.responseType = request.responseType;
254250

251+
if ('withCredentials' in xhr) {
252+
xhr.withCredentials = !!request.withCredentials;
253+
}
254+
255255
// set headers
256256
this.setHeaders(xhr, headers);
257257

0 commit comments

Comments
 (0)