Run cargo fmt

This commit is contained in:
Jordan Johnson-Doyle 2019-02-15 22:01:22 +00:00
parent b32010f905
commit 09e411739a
No known key found for this signature in database
GPG key ID: A95F87B578CE79B6
4 changed files with 61 additions and 34 deletions

View file

@ -1,7 +1,7 @@
use std::ops::Deref;
use rocket::Request;
use rocket::request::{FromRequest, Outcome};
use rocket::Request;
/// Holds a value that determines whether or not this request wanted a plaintext response.
///
@ -27,9 +27,15 @@ impl<'a, 'r> FromRequest<'a, 'r> for IsPlaintextRequest {
}
}
match request.headers().get_one("User-Agent").and_then(|u| u.splitn(2, '/').next()) {
None | Some("Wget") | Some("curl") | Some("HTTPie") => Outcome::Success(IsPlaintextRequest(true)),
_ => Outcome::Success(IsPlaintextRequest(false))
match request
.headers()
.get_one("User-Agent")
.and_then(|u| u.splitn(2, '/').next())
{
None | Some("Wget") | Some("curl") | Some("HTTPie") => {
Outcome::Success(IsPlaintextRequest(true))
}
_ => Outcome::Success(IsPlaintextRequest(false)),
}
}
}
@ -54,4 +60,4 @@ impl<'a, 'r> FromRequest<'a, 'r> for HostHeader<'a> {
fn from_request(request: &'a Request<'r>) -> Outcome<HostHeader<'a>, ()> {
Outcome::Success(HostHeader(request.headers().get_one("Host")))
}
}
}