Remove an unwrap() call in HTTP fetch.

This commit is contained in:
Ms2ger 2015-05-19 17:38:56 +02:00
parent b23f4266ad
commit 4ca6325bad

View file

@ -263,12 +263,12 @@ impl Request {
if !response.headers.has::<Location>() {
return response;
}
let location = response.headers.get::<Location>();
if location.is_none() {
return Response::network_error();
}
let location = match response.headers.get::<Location>() {
None => return Response::network_error(),
Some(location) => location,
};
// Step 5
let locationUrl = Url::parse(location.unwrap());
let locationUrl = Url::parse(location);
// Step 6
let locationUrl = match locationUrl {
Ok(url) => url,