Skip to content

Commit 71a19e5

Browse files
committed
Auto merge of #1165 - 00dani:xcloud-firefox-dev-edition, r=hobinjk
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`.
2 parents 8cc78a3 + 0056dcd commit 71a19e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Firefox/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ function onAttach(worker) {
9595
};
9696
if (headers) {
9797
requestSettings.headers = headers;
98+
if (headers['Content-Type']) {
99+
requestSettings.contentType = headers['Content-Type'];
100+
}
98101
}
99102
if (data) {
100103
requestSettings.content = data;

0 commit comments

Comments
 (0)