chore: revert status code change for delete users endpoint (#14168)

Revert from https://github.com/coder/coder/pull/13870
This commit is contained in:
Steven Masley
2024-08-05 13:10:56 -05:00
committed by GitHub
parent 4e0cb60eeb
commit b80d99550a
5 changed files with 12 additions and 10 deletions
+2 -2
View File
@@ -4935,8 +4935,8 @@ const docTemplate = `{
}
],
"responses": {
"204": {
"description": "No Content"
"200": {
"description": "OK"
}
}
}
+2 -2
View File
@@ -4351,8 +4351,8 @@
}
],
"responses": {
"204": {
"description": "No Content"
"200": {
"description": "OK"
}
}
}
+4 -2
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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).