mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make Response's Clone()
method to clone headers.
This patch allows the response clone to have the same headers list as the original's. Previously, only the cloned response's headers guard was set to be the same as the original response's headers guard.
This commit is contained in:
parent
f4ed2c6875
commit
25cc87f226
2 changed files with 2 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
||||||
use body::{BodyOperations, BodyType, consume_body, consume_body_with_promise};
|
use body::{BodyOperations, BodyType, consume_body, consume_body_with_promise};
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use dom::bindings::cell::DOMRefCell;
|
use dom::bindings::cell::DOMRefCell;
|
||||||
use dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
|
use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
|
||||||
use dom::bindings::codegen::Bindings::ResponseBinding;
|
use dom::bindings::codegen::Bindings::ResponseBinding;
|
||||||
use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType};
|
use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType};
|
||||||
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
|
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
|
||||||
|
@ -303,6 +303,7 @@ impl ResponseMethods for Response {
|
||||||
// Step 2
|
// Step 2
|
||||||
let new_response = Response::new(&self.global());
|
let new_response = Response::new(&self.global());
|
||||||
new_response.Headers().set_guard(self.Headers().get_guard());
|
new_response.Headers().set_guard(self.Headers().get_guard());
|
||||||
|
try!(new_response.Headers().fill(Some(HeadersInit::Headers(self.Headers()))));
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-response-clone
|
// https://fetch.spec.whatwg.org/#concept-response-clone
|
||||||
// Instead of storing a net_traits::Response internally, we
|
// Instead of storing a net_traits::Response internally, we
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
[response-clone.html]
|
[response-clone.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[Check Response's clone has the expected attribute values]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Check orginal response's body after cloning]
|
[Check orginal response's body after cloning]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue