diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 981be686df469..28ccc0630d7b7 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -4845,8 +4845,8 @@ const docTemplate = `{ } ], "responses": { - "204": { - "description": "No Content" + "200": { + "description": "OK" } } } diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 14efc71711687..2008e23744db7 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -4273,8 +4273,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..a715194c11978 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -309,7 +309,9 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error { return err } defer res.Body.Close() - if res.StatusCode != http.StatusNoContent { + // Check for a 200 or a 204 response. 2.14.0 accidentally included a 204 response, + // which was a breaking change, and reverted in 2.14.1. + if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNoContent { 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). diff --git a/site/src/router.tsx b/site/src/router.tsx index 615d12969e184..634625b1fb8a2 100644 --- a/site/src/router.tsx +++ b/site/src/router.tsx @@ -472,6 +472,10 @@ export const router = createBrowserRouter( {/* Pages that don't have the dashboard layout */} } /> + } + /> }