Skip to content

Commit

Permalink
Make Response's Clone() method to clone headers.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeenalee committed Oct 21, 2016
1 parent f4ed2c6 commit 25cc87f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/script/dom/response.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/wpt/metadata/fetch/api/response/response-clone.html.ini
@@ -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
Expand Down

0 comments on commit 25cc87f

Please sign in to comment.