From 7b03432b529f00d5868c5e0b645aa871dae29c8e Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 5 Aug 2024 11:55:34 -0500 Subject: [PATCH] chore: revert status code change for delete users endpoint Revert from https://github.com/coder/coder/pull/13870 --- coderd/apidoc/docs.go | 4 ++-- coderd/apidoc/swagger.json | 4 ++-- coderd/users.go | 6 ++++-- codersdk/users.go | 2 +- docs/api/users.md | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 962fccae0a4ea..a26dc4b744cc1 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -4935,8 +4935,8 @@ const docTemplate = `{ } ], "responses": { - "204": { - "description": "No Content" + "200": { + "description": "OK" } } } diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 35b8b82a21888..1e017c275df02 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -4351,8 +4351,8 @@ } ], "responses": { - "204": { - "description": "No Content" + "200": { + "description": "OK" } } } diff --git a/coderd/users.go b/coderd/users.go index adf329ea0059d..cde7271ca4e5d 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -513,7 +513,7 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) { // @Security CoderSessionToken // @Tags Users // @Param user path string true "User ID, name, or me" -// @Success 204 +// @Success 200 // @Router /users/{user} [delete] func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -588,7 +588,9 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) { } } - rw.WriteHeader(http.StatusNoContent) + httpapi.Write(ctx, rw, http.StatusOK, codersdk.Response{ + Message: "User has been deleted!", + }) } // Returns the parameterized user requested. All validation diff --git a/codersdk/users.go b/codersdk/users.go index 391363309f577..4de5457edc5ec 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -309,7 +309,7 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error { return err } defer res.Body.Close() - if res.StatusCode != http.StatusNoContent { + if res.StatusCode != http.StatusOK { return ReadBodyAsError(res) } return nil diff --git a/docs/api/users.md b/docs/api/users.md index 5b521183fcd23..05af30df869e0 100644 --- a/docs/api/users.md +++ b/docs/api/users.md @@ -426,9 +426,9 @@ curl -X DELETE http://coder-server:8080/api/v2/users/{user} \ ### Responses -| Status | Meaning | Description | Schema | -| ------ | --------------------------------------------------------------- | ----------- | ------ | -| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | | +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | ------ | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | | To perform this operation, you must be authenticated. [Learn more](authentication.md). pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy