Skip to content

Commit

Permalink
Bodyless -> No Content
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Oct 29, 2024
1 parent d645cfc commit 35cfbda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/main/lrsql/admin/interceptors/account.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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}))}))
Expand Down
4 changes: 2 additions & 2 deletions src/main/lrsql/admin/routes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35cfbda

Please sign in to comment.