Don't allocate a String into after parsing a cookie.

This commit is contained in:
Sergio Benitez 2017-03-08 03:39:57 -08:00
parent 16cb7297ab
commit 4f8894f645
1 changed files with 2 additions and 2 deletions

View File

@ -34,8 +34,8 @@ impl<'a> Session<'a> {
return None;
}
let string = cookie_str[SESSION_PREFIX.len()..].to_string();
Cookie::parse(string).ok()
Cookie::parse(&cookie_str[SESSION_PREFIX.len()..]).ok()
.map(|c| c.into_owned())
}
pub fn get(&self, name: &str) -> Option<Cookie<'static>> {