Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions xhr/setrequestheader-content-type.htm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
"text/javascript;charset=UTF-8",
"String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"
)
request(
function _String() { return "test"; },
{"Content-Type": "application/xml"},
"application/xml",
"String request keeps setRequestHeader() Content-Type without charset"
)
request(
function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },
{"Content-Type": ""},
Expand All @@ -86,6 +92,12 @@
"application/xhtml+xml;charset=UTF-8",
"XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"
)
request(
function _XMLDocument() { return new DOMParser().parseFromString("<xml/>", "application/xml"); },
{"Content-Type": "application/xhtml+xml"},
"application/xhtml+xml",
"XML Document request keeps setRequestHeader() Content-Type without charset"
)
request(
function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },
{"Content-Type": ""},
Expand All @@ -104,6 +116,12 @@
"text/html+junk;charset=UTF-8",
"HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"
)
request(
function _HTMLDocument() { return new DOMParser().parseFromString("<html></html>", "text/html"); },
{"Content-Type": "text/html+junk"},
"text/html+junk",
"HTML Document request keeps setRequestHeader() Content-Type without charset"
)
request(
function _Blob() { return new Blob(["test"]); },
{"Content-Type": ""},
Expand Down Expand Up @@ -206,6 +224,18 @@
"application/x-www-form-urlencoded;charset=UTF-8",
'URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8"'
)
request(
function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },
{"Content-Type": "application/xml;charset=ASCII"},
"application/xml;charset=UTF-8",
"URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8"
)
request(
function _URLSearchParams() { return new URLSearchParams("q=testQ&topic=testTopic") },
{"Content-Type": "application/xml"},
"application/xml",
"URLSearchParams request keeps setRequestHeader() Content-Type without charset"
)
</script>
</body>
</html>
Loading