diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-05-19 17:38:56 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-05-19 17:38:56 +0200 |
commit | 4ca6325bad1d93b4e5c552d4b75663852a2a8868 (patch) | |
tree | 335e5069896b991ef62691641caf799c68db451c /components/net/fetch/request.rs | |
parent | b23f4266ad9f6603067cc6ab45c921d7c0aff9e7 (diff) | |
download | servo-4ca6325bad1d93b4e5c552d4b75663852a2a8868.tar.gz servo-4ca6325bad1d93b4e5c552d4b75663852a2a8868.zip |
Remove an unwrap() call in HTTP fetch.
Diffstat (limited to 'components/net/fetch/request.rs')
-rw-r--r-- | components/net/fetch/request.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index 7c44e5f14d5..42a9b737a21 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -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, |