From d956201af340a44a5798c32629088339695c6256 Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sat, 16 Aug 2014 00:12:28 -0400 Subject: [PATCH] Check if content-type header exists Fixes #19 --- core-ajax.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core-ajax.html b/core-ajax.html index bb7df26..db0d227 100644 --- a/core-ajax.html +++ b/core-ajax.html @@ -303,7 +303,10 @@ if (args.headers && typeof(args.headers) == 'string') { args.headers = JSON.parse(args.headers); } - if (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' ||