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

Commit

Permalink
fix(form-data): contentType property must be set to null when sendi…
Browse files Browse the repository at this point in the history
…ng `FormData` payload

fixes #5
  • Loading branch information
rnicholus committed Nov 13, 2014
1 parent 1f646f5 commit aacea6d
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 is 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 aacea6d

Please sign in to comment.