delete header in some special cases

This commit is contained in:
Dennis Eichhorn 2020-06-18 20:37:00 +02:00
parent 91d43a63af
commit 27470758e7

View File

@ -35,7 +35,7 @@ export class Request
this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type); this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type);
if (this.type === RequestType.FORM_DATA) { if (this.type === RequestType.FORM_DATA) {
delete this.requestHeader['Content-Type'] delete this.requestHeader['Content-Type'];
} }
this.result[0] = function(xhr) this.result[0] = function(xhr)
@ -197,6 +197,10 @@ export class Request
setRequestHeader(type, header) setRequestHeader(type, header)
{ {
this.requestHeader[type] = header; this.requestHeader[type] = header;
if (header === 'multipart/form-data') {
delete this.requestHeader[type];
}
}; };
/** /**
@ -309,7 +313,7 @@ export class Request
this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type); this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type);
if (this.type === RequestType.FORM_DATA) { if (this.type === RequestType.FORM_DATA) {
delete this.requestHeader['Content-Type'] delete this.requestHeader['Content-Type'];
} }
}; };