From 6501529f68cb2e9f3a6921de19d0f14f3b4e171d Mon Sep 17 00:00:00 2001 From: finscn Date: Thu, 28 May 2015 22:18:43 +0800 Subject: [PATCH 1/2] ignore case of "Content-Type" and "Content-type" ignore case of "Content-Type" and "Content-type" Most JS libraries use "Content-type". --- lib/XMLHttpRequest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 949fdf9..214ada8 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -348,7 +348,7 @@ exports.XMLHttpRequest = function() { } else if (data) { headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data); - if (!headers["Content-Type"]) { + if (!headers["Content-Type"] && !headers["Content-type"]) { headers["Content-Type"] = "text/plain;charset=UTF-8"; } } else if (settings.method === "POST") { From 2331ad2b34046d3282307fa01412acb4b5f6ccbe Mon Sep 17 00:00:00 2001 From: finscn Date: Thu, 28 May 2015 22:32:57 +0800 Subject: [PATCH 2/2] Update XMLHttpRequest.js --- lib/XMLHttpRequest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 214ada8..d230b11 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -348,7 +348,7 @@ exports.XMLHttpRequest = function() { } else if (data) { headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data); - if (!headers["Content-Type"] && !headers["Content-type"]) { + if (!headers["Content-Type"] && !headers["Content-type"] && !headers["content-type"]) { headers["Content-Type"] = "text/plain;charset=UTF-8"; } } else if (settings.method === "POST") {