From 0056dcd08c0769a2ed0b74bf4c66f9ff51d6f9aa Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Fri, 30 Sep 2016 15:24:45 +1000 Subject: [PATCH] Explicitly set contentType in Firefox's Request The default value is `"application/x-www-form-urlencoded"`, but we usually want JSON. In some versions of Firefox, passing `{headers: {"Content-Type": "application/json"}` to the Request constructor works. However in other versions, such as the latest Developer Edition 51.0a2, the actual header sent erroneously becomes `Content-Type: application/x-www-form-urlencoded, application/json`. This breaks XCloud and might break other services as well. This patch simply ensures that if we ask for `application/json`, we get `application/json`. --- Firefox/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Firefox/index.js b/Firefox/index.js index 29ddc35b6..7a408a42a 100644 --- a/Firefox/index.js +++ b/Firefox/index.js @@ -95,6 +95,9 @@ function onAttach(worker) { }; if (headers) { requestSettings.headers = headers; + if (headers['Content-Type']) { + requestSettings.contentType = headers['Content-Type']; + } } if (data) { requestSettings.content = data;