Fix the 'user_id' route in cookies guide.

This commit is contained in:
Sergio Benitez 2017-07-18 14:27:10 -04:00
parent 362afdc445
commit 6d3cd374ac
1 changed files with 2 additions and 3 deletions

View File

@ -402,9 +402,8 @@ methods are suffixed with `_private`. These methods are: [`get_private`],
/// Retrieve the user's ID, if any.
#[get("/user_id")]
fn user_id(cookies: Cookies) -> Option<String> {
request.cookies()
.get_private("user_id")
.map(|cookie| format!("User ID: {}", cookie.value()))
cookies.get_private("user_id")
.map(|cookie| format!("User ID: {}", cookie.value()))
}
/// Remove the `user_id` cookie.