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 #20 from elliottsj/master
Browse files Browse the repository at this point in the history
Prevent adding 'content-type' header if one already exists
  • Loading branch information
dfreedm committed Aug 22, 2014
2 parents 06f5ed6 + 3ded43b commit edb0b70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core-ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@
if (args.headers && typeof(args.headers) == 'string') {
args.headers = JSON.parse(args.headers);
}
if (this.contentType) {
args.headers['content-type'] = this.contentType;
var hasContentType = Object.keys(args.headers).some(function (header) {
return header.toLowerCase() === 'content-type';
});
if (!hasContentType && this.contentType) {
args.headers['Content-Type'] = this.contentType;
}
if (this.handleAs === 'arraybuffer' || this.handleAs === 'blob' ||
this.handleAs === 'document') {
Expand Down

0 comments on commit edb0b70

Please sign in to comment.