Skip to content

Commit

Permalink
Auto merge of #1165 - 00dani:xcloud-firefox-dev-edition, r=hobinjk
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
homu committed Oct 2, 2016
2 parents 8cc78a3 + 0056dcd commit 71a19e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Firefox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71a19e5

Please sign in to comment.