Auto merge of #11824 - DarinM223:master, r=KiChjang

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

<!-- Please describe your changes on the following line: -->
Mutates the header directly with get_mut instead of using get(), remove(), and set().
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11811  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because there are existing web tests

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11824)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-28 14:06:17 -05:00 committed by GitHub
commit a3f43076b6
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);
}
}