Add location_url to Metadata struct

This commit is contained in:
Keith Yeung 2017-07-04 19:53:17 -07:00
parent d6c197b40c
commit 5b69d18fca
3 changed files with 8 additions and 0 deletions

View file

@ -82,6 +82,7 @@ pub struct ResponseInit {
#[ignore_heap_size_of = "Defined in hyper"]
pub headers: Headers,
pub referrer: Option<ServoUrl>,
pub location_url: Option<Result<ServoUrl, String>>,
}
/// A [Response](https://fetch.spec.whatwg.org/#concept-response) as defined by the Fetch spec
@ -138,6 +139,7 @@ impl Response {
pub fn from_init(init: ResponseInit) -> Response {
let mut res = Response::new(init.url);
res.location_url = init.location_url;
res.headers = init.headers;
res.referrer = init.referrer;
res
@ -287,6 +289,7 @@ impl Response {
Some(&ContentType(ref mime)) => Some(mime),
None => None,
});
metadata.location_url = response.location_url.clone();
metadata.headers = Some(Serde(response.headers.clone()));
metadata.status = response.raw_status.clone();
metadata.https_state = response.https_state;