Use get_mut instead of get-remove-set in XHR send()

This commit is contained in:
Darin Minamoto 2016-06-27 21:31:28 -07:00
parent 00af25b685
commit fc6e20f652
11 changed files with 30 additions and 34 deletions

View file

@ -32,7 +32,7 @@ gfx_traits = {path = "../gfx_traits"}
heapsize = "0.3.6"
heapsize_plugin = "0.1.2"
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
hyper = {version = "0.9", features = ["serde-serialization"]}
hyper = {version = "0.9.9", features = ["serde-serialization"]}
image = "0.10"
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
js = {git = "https://github.com/servo/rust-mozjs"}

View file

@ -635,7 +635,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
if !content_type_set {
let ct = request.headers.get::<ContentType>().map(|x| x.clone());
let ct = request.headers.get_mut::<ContentType>();
if let Some(mut ct) = ct {
if let Some(encoding) = encoding {
for param in &mut (ct.0).2 {
@ -646,10 +646,6 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
}
}
// remove instead of mutate in place
// https://github.com/hyperium/hyper/issues/821
request.headers.remove_raw("content-type");
request.headers.set(ct);
}
}