mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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:
commit
a3f43076b6
11 changed files with 30 additions and 34 deletions
|
@ -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"}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue