From 35cfbda14a782d743231ce26618ae3d11e2c8136 Mon Sep 17 00:00:00 2001 From: kelvinqian00 Date: Tue, 29 Oct 2024 15:40:17 -0400 Subject: [PATCH] Bodyless -> No Content --- doc/endpoints.md | 2 +- src/main/lrsql/admin/interceptors/account.clj | 6 +++--- src/main/lrsql/admin/routes.clj | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/endpoints.md b/doc/endpoints.md index f6f6e121..30a71407 100644 --- a/doc/endpoints.md +++ b/doc/endpoints.md @@ -31,7 +31,7 @@ The response body contains a newly generated JSON Web Token (JWT) on success. A - `DELETE http://example.org/admin/account`: Delete an existing account. The JSON request body must contain a UUID `account-id` value. The endpoint returns a JSON object with the ID of the deleted account on success and returns a `404 NOT FOUND` error if the account does not exist. - `GET http://example.org/admin/account`: Return an array of all admin accounts in the system on success. - `GET http://example.org/admin/me`: Returns the currently authenticated admin accounts on success. -- `GET http://example.org/admin/verify`: Returns a `204 OK` response, without a body, on success (the success conditions are the same as the `/admin/me` endpoint). +- `GET http://example.org/admin/verify`: Returns a `204 No Content` response, without a body, on success (the success conditions are the same as the `/admin/me` endpoint). #### Admin Credential Routes diff --git a/src/main/lrsql/admin/interceptors/account.clj b/src/main/lrsql/admin/interceptors/account.clj index 1c00d7fe..93e47e11 100644 --- a/src/main/lrsql/admin/interceptors/account.clj +++ b/src/main/lrsql/admin/interceptors/account.clj @@ -250,10 +250,10 @@ :response {:status 200 :body result})))})) -(def bodyless - "Return a 204 OK response without a body." +(def no-content + "Return a 204 No Content response, without a body." (interceptor - {:name ::get-bodyless + {:name ::get-no-content :enter (fn get-account [ctx] (assoc ctx :response {:status 204}))})) diff --git a/src/main/lrsql/admin/routes.clj b/src/main/lrsql/admin/routes.clj index c7db6cb9..5fd1b327 100644 --- a/src/main/lrsql/admin/routes.clj +++ b/src/main/lrsql/admin/routes.clj @@ -122,11 +122,11 @@ (ji/validate-jwt jwt-secret jwt-leeway no-val-opts) ji/validate-jwt-account - ai/bodyless)] + ai/no-content)] {:description "Verify that querying account is logged in" :operationId :verify-own-account :security [{:bearerAuth []}] - :responses {204 (g/response "No body") + :responses {204 (g/response "No content body") 401 (g/rref :error-401)}}) ;; Delete account (and associated credentials) (gc/annotate