diff --git a/src/params.rs b/src/params.rs index 2e08228..e8b7930 100644 --- a/src/params.rs +++ b/src/params.rs @@ -24,12 +24,16 @@ impl<'a, 'r> FromRequest<'a, 'r> for IsPlaintextRequest { } } -pub struct HostHeader(pub Option); +/// Gets the Host header from the request. +/// +/// The inner value of this `HostHeader` will be `None` if there was no Host header +/// on the request. +pub struct HostHeader<'a>(pub Option<&'a str>); -impl<'a, 'r> FromRequest<'a, 'r> for HostHeader { +impl<'a, 'r> FromRequest<'a, 'r> for HostHeader<'a> { type Error = (); - fn from_request(request: &'a Request<'r>) -> Outcome { - Outcome::Success(HostHeader(request.headers().get_one("Host").map(|h| h.to_string()))) + fn from_request(request: &'a Request<'r>) -> Outcome, ()> { + Outcome::Success(HostHeader(request.headers().get_one("Host"))) } } \ No newline at end of file