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

Commit

Permalink
Merge pull request #46 from rnicholus/patch-2
Browse files Browse the repository at this point in the history
fix(form-data): `contentType` property must be null when sending `FormData` payload.
  • Loading branch information
garlicnation committed Nov 29, 2014
2 parents 1f646f5 + 956f5c4 commit 7cbed4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core-ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@
var hasContentType = Object.keys(args.headers).some(function (header) {
return header.toLowerCase() === 'content-type';
});
if (!hasContentType && this.contentType) {
// No Content-Type should be specified if sending `FormData`.
// The UA must set the Content-Type w/ a calculated multipart boundary ID.
if (args.body instanceof FormData) {
delete args.headers['Content-Type'];
}
else if (!hasContentType && this.contentType) {
args.headers['Content-Type'] = this.contentType;
}
if (this.handleAs === 'arraybuffer' || this.handleAs === 'blob' ||
Expand Down

0 comments on commit 7cbed4b

Please sign in to comment.