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:
Jeena Lee 2016-10-21 09:14:57 -07:00
parent f4ed2c6875
commit 25cc87f226
2 changed files with 2 additions and 4 deletions

View file

@ -5,7 +5,7 @@
use body::{BodyOperations, BodyType, consume_body, consume_body_with_promise};
use core::cell::Cell;
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::{ResponseMethods, ResponseType as DOMResponseType};
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
@ -303,6 +303,7 @@ impl ResponseMethods for Response {
// Step 2
let new_response = Response::new(&self.global());
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
// Instead of storing a net_traits::Response internally, we

View file

@ -1,8 +1,5 @@
[response-clone.html]
type: testharness
[Check Response's clone has the expected attribute values]
expected: FAIL
[Check orginal response's body after cloning]
expected: FAIL