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>() { if !response.headers.has::<Location>() {
return response; return response;
} }
let location = response.headers.get::<Location>(); let location = match response.headers.get::<Location>() {
if location.is_none() { None => return Response::network_error(),
return Response::network_error(); Some(location) => location,
} };
// Step 5 // Step 5
let locationUrl = Url::parse(location.unwrap()); let locationUrl = Url::parse(location);
// Step 6 // Step 6
let locationUrl = match locationUrl { let locationUrl = match locationUrl {
Ok(url) => url, Ok(url) => url,