From a0e4bba54eae53d43792e75b67b500b56e333db0 Mon Sep 17 00:00:00 2001 From: Damian Cantu Date: Mon, 26 Aug 2019 11:01:24 -0500 Subject: [PATCH] Adding withCredentials to uploader options --- src/file-upload/file-uploader.class.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file-upload/file-uploader.class.ts b/src/file-upload/file-uploader.class.ts index 0a60acfe..1c96ac14 100644 --- a/src/file-upload/file-uploader.class.ts +++ b/src/file-upload/file-uploader.class.ts @@ -39,6 +39,7 @@ export interface FileUploaderOptions { parametersBeforeFiles?: boolean; formatDataFunction?: Function; formatDataFunctionIsAsync?: boolean; + withCredentials?: boolean; } export class FileUploader { @@ -51,6 +52,7 @@ export class FileUploader { public autoUpload: any; public authTokenHeader: string; public response: EventEmitter; + public withCredentials: boolean = null; public options: FileUploaderOptions = { autoUpload: false, @@ -75,6 +77,8 @@ export class FileUploader { this.authToken = this.options.authToken; this.authTokenHeader = this.options.authTokenHeader || 'Authorization'; this.autoUpload = this.options.autoUpload; + this.withCredentials = this.options.withCredentials; + this.options.filters.unshift({ name: 'queueLimit', fn: this._queueLimitFilter }); if (this.options.maxFileSize) { @@ -357,7 +361,7 @@ export class FileUploader { this._onCompleteItem(item, response, xhr.status, headers); }; xhr.open(item.method, item.url, true); - xhr.withCredentials = item.withCredentials; + xhr.withCredentials = this.withCredentials !== null ? this.withCredentials : item.withCredentials; if (this.options.headers) { for (let header of this.options.headers) { xhr.setRequestHeader(header.name, header.value);