diff options
author | Pyfisch <pyfisch@gmail.com> | 2018-11-06 13:01:35 +0100 |
---|---|---|
committer | Pyfisch <pyfisch@gmail.com> | 2018-11-06 22:30:31 +0100 |
commit | cb07debcb6f3d3561177ce536c320986720791b7 (patch) | |
tree | ccac4d5a48b3112230f3fc2e873753dd7263e9fb /components/script/dom/request.rs | |
parent | bf47f90da667e95eaffc8fee36ca8a88e72e276c (diff) | |
download | servo-cb07debcb6f3d3561177ce536c320986720791b7.tar.gz servo-cb07debcb6f3d3561177ce536c320986720791b7.zip |
Format remaining files
Diffstat (limited to 'components/script/dom/request.rs')
-rw-r--r-- | components/script/dom/request.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 8a6d7108a0f..139931375f7 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -285,7 +285,8 @@ impl Request { } // Step 25.2 let method = match init_method.as_str() { - Some(s) => normalize_method(s).map_err(|e| Error::Type(format!("Method is not valid: {:?}", e)))?, + Some(s) => normalize_method(s) + .map_err(|e| Error::Type(format!("Method is not valid: {:?}", e)))?, None => return Err(Error::Type("Method is not a valid UTF8".to_string())), }; // Step 25.3 @@ -375,10 +376,16 @@ impl Request { let req = r.request.borrow(); let req_method = &req.method; match *req_method { - HttpMethod::GET => return Err(Error::Type( - "Init's body is non-null, and request method is GET".to_string())), - HttpMethod::HEAD => return Err(Error::Type( - "Init's body is non-null, and request method is HEAD".to_string())), + HttpMethod::GET => { + return Err(Error::Type( + "Init's body is non-null, and request method is GET".to_string(), + )) + }, + HttpMethod::HEAD => { + return Err(Error::Type( + "Init's body is non-null, and request method is HEAD".to_string(), + )) + }, _ => {}, } } @@ -500,9 +507,7 @@ fn is_forbidden_method(m: &ByteString) -> bool { // https://fetch.spec.whatwg.org/#cors-safelisted-method fn is_cors_safelisted_method(m: &HttpMethod) -> bool { - m == &HttpMethod::GET || - m == &HttpMethod::HEAD || - m == &HttpMethod::POST + m == &HttpMethod::GET || m == &HttpMethod::HEAD || m == &HttpMethod::POST } // https://url.spec.whatwg.org/#include-credentials |