feat(file-upload): Add the possibility of set the token header (#213)
It will be very useful set which is the Token that is going to be send to the server
This commit was merged in pull request #213.
This commit is contained in:
committed by
Dmitriy Shekhovtsov
parent
1a4eb3a0fd
commit
282295ce20
@@ -59,6 +59,7 @@ export class FileUploader {
|
|||||||
this.options = Object.assign(this.options, options);
|
this.options = Object.assign(this.options, options);
|
||||||
|
|
||||||
this.authToken = options.authToken;
|
this.authToken = options.authToken;
|
||||||
|
this.authTokenHeader = options.authTokenHeader || 'Authorization';
|
||||||
this.autoUpload = options.autoUpload;
|
this.autoUpload = options.autoUpload;
|
||||||
this.options.filters.unshift({name: 'queueLimit', fn: this._queueLimitFilter});
|
this.options.filters.unshift({name: 'queueLimit', fn: this._queueLimitFilter});
|
||||||
|
|
||||||
@@ -344,7 +345,7 @@ export class FileUploader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.authToken) {
|
if (this.authToken) {
|
||||||
xhr.setRequestHeader('Authorization', this.authToken);
|
xhr.setRequestHeader(this.authTokenHeader, this.authToken);
|
||||||
}
|
}
|
||||||
xhr.send(sendable);
|
xhr.send(sendable);
|
||||||
this._render();
|
this._render();
|
||||||
|
|||||||
Reference in New Issue
Block a user