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::() { return response; } - let location = response.headers.get::(); - if location.is_none() { - return Response::network_error(); - } + let location = match response.headers.get::() { + 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,