Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit aacea6d

Browse files
committed
fix(form-data): contentType property must be set to null when sending FormData payload
fixes #5
1 parent 1f646f5 commit aacea6d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core-ajax.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,12 @@
367367
var hasContentType = Object.keys(args.headers).some(function (header) {
368368
return header.toLowerCase() === 'content-type';
369369
});
370-
if (!hasContentType && this.contentType) {
370+
// No Content-Type should be specified is sending `FormData`.
371+
// The UA must set the Content-Type w/ a calculated multipart boundary ID.
372+
if (args.body instanceof FormData) {
373+
delete args.headers['Content-Type'];
374+
}
375+
else if (!hasContentType && this.contentType) {
371376
args.headers['Content-Type'] = this.contentType;
372377
}
373378
if (this.handleAs === 'arraybuffer' || this.handleAs === 'blob' ||

0 commit comments

Comments
 (0)