diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-05-01 16:39:43 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-05-27 12:19:16 +0200 |
commit | 6802bafc399011726c51ca55fdde6d34f98430f1 (patch) | |
tree | 6d48f33ed2f48e7d2f6c95fa92b736d9718d4d24 /components/script/dom/xmlhttprequest.rs | |
parent | 8759d42559bc5c10f8d90903f33f75bddf44d9fe (diff) | |
download | servo-6802bafc399011726c51ca55fdde6d34f98430f1.tar.gz servo-6802bafc399011726c51ca55fdde6d34f98430f1.zip |
Cleanup URLSearchParams
It now uses rust-url for its serializer.
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 13 |
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() + }, } } } |