aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/net/fetch/methods.rs2
-rw-r--r--components/net_traits/response.rs6
-rw-r--r--tests/unit/net/fetch.rs2
3 files changed, 7 insertions, 3 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index 72d7e5c1e2a..84d4956b92c 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -687,7 +687,7 @@ fn http_redirect_fetch<UI: 'static + UIProvider>(request: Rc<Request>,
Some(&Location(ref location)) => location.clone(),
_ => return Response::network_error(NetworkError::Internal("Location header parsing failure".into()))
};
- let response_url = response.actual_response().url.as_ref().unwrap();
+ let response_url = response.actual_response().url().unwrap();
let location_url = response_url.join(&*location);
let location_url = match location_url {
Ok(url) => url,
diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs
index e9509779f61..62d1b5bfcd0 100644
--- a/components/net_traits/response.rs
+++ b/components/net_traits/response.rs
@@ -79,7 +79,7 @@ pub enum ResponseMsg {
pub struct Response {
pub response_type: ResponseType,
pub termination_reason: Option<TerminationReason>,
- pub url: Option<Url>,
+ url: Option<Url>,
pub url_list: RefCell<Vec<Url>>,
/// `None` can be considered a StatusCode of `0`.
#[ignore_heap_size_of = "Defined in hyper"]
@@ -136,6 +136,10 @@ impl Response {
}
}
+ pub fn url(&self) -> Option<&Url> {
+ self.url.as_ref()
+ }
+
pub fn is_network_error(&self) -> bool {
match self.response_type {
ResponseType::Error(..) => true,
diff --git a/tests/unit/net/fetch.rs b/tests/unit/net/fetch.rs
index 6bef297cbbb..45dffcaa3a0 100644
--- a/tests/unit/net/fetch.rs
+++ b/tests/unit/net/fetch.rs
@@ -383,8 +383,8 @@ fn test_fetch_response_is_opaque_filtered() {
assert!(!fetch_response.is_network_error());
assert_eq!(fetch_response.response_type, ResponseType::Opaque);
+ assert!(fetch_response.url().is_none());
assert!(fetch_response.url_list.into_inner().len() == 0);
- assert!(fetch_response.url.is_none());
// this also asserts that status message is "the empty byte sequence"
assert!(fetch_response.status.is_none());
assert_eq!(fetch_response.headers, Headers::new());