No need to clone the Host header
Diff
src/params.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -24,12 +24,16 @@
}
}
pub struct HostHeader(pub Option<String>);
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<HostHeader, ()> {
Outcome::Success(HostHeader(request.headers().get_one("Host").map(|h| h.to_string())))
fn from_request(request: &'a Request<'r>) -> Outcome<HostHeader<'a>, ()> {
Outcome::Success(HostHeader(request.headers().get_one("Host")))
}
}