aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xmlhttprequest.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r--components/script/dom/xmlhttprequest.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 99d412ee8b7..5044feae3b7 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -1129,12 +1129,17 @@ trait Extractable {
fn extract(&self) -> Vec<u8>;
}
impl Extractable for SendParam {
+ // https://fetch.spec.whatwg.org/#concept-bodyinit-extract
fn extract(&self) -> Vec<u8> {
- // https://fetch.spec.whatwg.org/#concept-fetchbodyinit-extract
- let encoding = UTF_8 as EncodingRef;
match *self {
- eString(ref s) => encoding.encode(s, EncoderTrap::Replace).unwrap(),
- eURLSearchParams(ref usp) => usp.root().r().serialize(None) // Default encoding is UTF8
+ eString(ref s) => {
+ let encoding = UTF_8 as EncodingRef;
+ encoding.encode(s, EncoderTrap::Replace).unwrap()
+ },
+ eURLSearchParams(ref usp) => {
+ // Default encoding is UTF-8.
+ usp.root().r().serialize(None).as_bytes().to_owned()
+ },
}
}
}