diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-08-24 03:32:21 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-08-24 04:51:24 -0400 |
| commit | c1d688146956a23366c8e076328bb53351b999b5 (patch) | |
| tree | 3ec84ed38448b2179a76241e69a5a2994bf7a2c9 /src/user/handlers/logout/mod.rs | |
| parent | 53944ef14af4d37c08464cb1bb9f3a8f09277194 (diff) | |
Define a canonical "empty" response.
This is a bit tidier and easier to assert on than returning a bare HTTP status code, but is otherwise interchangeable with it.
Diffstat (limited to 'src/user/handlers/logout/mod.rs')
| -rw-r--r-- | src/user/handlers/logout/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/user/handlers/logout/mod.rs b/src/user/handlers/logout/mod.rs index 45a376a..4450e4c 100644 --- a/src/user/handlers/logout/mod.rs +++ b/src/user/handlers/logout/mod.rs @@ -1,12 +1,12 @@ use axum::{ extract::{Json, State}, - http::StatusCode, response::{IntoResponse, Response}, }; use crate::{ app::App, clock::RequestedAt, + empty::Empty, error::{Internal, Unauthorized}, token::{app, extract::IdentityCookie}, }; @@ -19,14 +19,14 @@ pub async fn handler( RequestedAt(now): RequestedAt, identity: IdentityCookie, Json(_): Json<Request>, -) -> Result<(IdentityCookie, StatusCode), Error> { +) -> Result<(IdentityCookie, Empty), Error> { if let Some(secret) = identity.secret() { let (token, _) = app.tokens().validate(&secret, &now).await?; app.tokens().logout(&token).await?; } let identity = identity.clear(); - Ok((identity, StatusCode::NO_CONTENT)) + Ok((identity, Empty)) } // This forces the only valid request to be `{}`, and not the infinite |
