mirror of https://github.com/rwf2/Rocket.git
Fix the 'user_id' route in cookies guide.
This commit is contained in:
parent
362afdc445
commit
6d3cd374ac
|
@ -402,9 +402,8 @@ methods are suffixed with `_private`. These methods are: [`get_private`],
|
||||||
/// Retrieve the user's ID, if any.
|
/// Retrieve the user's ID, if any.
|
||||||
#[get("/user_id")]
|
#[get("/user_id")]
|
||||||
fn user_id(cookies: Cookies) -> Option<String> {
|
fn user_id(cookies: Cookies) -> Option<String> {
|
||||||
request.cookies()
|
cookies.get_private("user_id")
|
||||||
.get_private("user_id")
|
.map(|cookie| format!("User ID: {}", cookie.value()))
|
||||||
.map(|cookie| format!("User ID: {}", cookie.value()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove the `user_id` cookie.
|
/// Remove the `user_id` cookie.
|
||||||
|
|
Loading…
Reference in New Issue