Skip to content

Commit 608ea69

Browse files
committed
split out the body stuff into a different branch
1 parent e1dd5b8 commit 608ea69

File tree

11 files changed

+56
-18
lines changed

11 files changed

+56
-18
lines changed

coderd/apidoc/docs.go

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apikey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func (api *API) deleteAPIKey(rw http.ResponseWriter, r *http.Request) {
333333
return
334334
}
335335

336-
rw.WriteHeader(http.StatusNoContent)
336+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
337337
}
338338

339339
// @Summary Get token config

coderd/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Requ
235235

236236
if bytes.Equal(settingsJSON, []byte(currentSettingsJSON)) {
237237
// See: https://www.rfc-editor.org/rfc/rfc7231#section-6.3.5
238-
rw.WriteHeader(http.StatusNoContent)
238+
httpapi.Write(r.Context(), rw, http.StatusNoContent, nil)
239239
return
240240
}
241241

coderd/externalauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (api *API) postExternalAuthDeviceByID(rw http.ResponseWriter, r *http.Reque
197197
return
198198
}
199199
}
200-
rw.WriteHeader(http.StatusNoContent)
200+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
201201
}
202202

203203
// @Summary Get external auth device by ID.

coderd/identityprovider/revoke.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ func RevokeApp(db database.Store) http.HandlerFunc {
3939
httpapi.InternalServerError(rw, err)
4040
return
4141
}
42-
rw.WriteHeader(http.StatusNoContent)
42+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
4343
}
4444
}

coderd/oauth2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (api *API) deleteOAuth2ProviderApp(rw http.ResponseWriter, r *http.Request)
207207
})
208208
return
209209
}
210-
rw.WriteHeader(http.StatusNoContent)
210+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
211211
}
212212

213213
// @Summary Get OAuth2 application secrets.
@@ -324,7 +324,7 @@ func (api *API) deleteOAuth2ProviderAppSecret(rw http.ResponseWriter, r *http.Re
324324
})
325325
return
326326
}
327-
rw.WriteHeader(http.StatusNoContent)
327+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
328328
}
329329

330330
// @Summary OAuth2 authorization request.

coderd/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
791791

792792
if updated.UpdatedAt.IsZero() {
793793
aReq.New = template
794-
rw.WriteHeader(http.StatusNotModified)
794+
httpapi.Write(ctx, rw, http.StatusNotModified, nil)
795795
return
796796
}
797797
aReq.New = updated

coderd/users.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
504504
// @Produce json
505505
// @Tags Users
506506
// @Param user path string true "User ID, name, or me"
507-
// @Success 204
507+
// @Success 200 {object} codersdk.User
508508
// @Router /users/{user} [delete]
509509
func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
510510
ctx := r.Context()
@@ -558,7 +558,9 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
558558
}
559559
user.Deleted = true
560560
aReq.New = user
561-
rw.WriteHeader(http.StatusNoContent)
561+
httpapi.Write(ctx, rw, http.StatusOK, codersdk.Response{
562+
Message: "User has been deleted!",
563+
})
562564
}
563565

564566
// Returns the parameterized user requested. All validation
@@ -1011,7 +1013,7 @@ func (api *API) putUserPassword(rw http.ResponseWriter, r *http.Request) {
10111013
newUser.HashedPassword = []byte(hashedPassword)
10121014
aReq.New = newUser
10131015

1014-
rw.WriteHeader(http.StatusNoContent)
1016+
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
10151017
}
10161018

10171019
// @Summary Get user roles

coderd/workspaces.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,9 @@ func (api *API) putWorkspaceDormant(rw http.ResponseWriter, r *http.Request) {
927927

928928
// If the workspace is already in the desired state do nothing!
929929
if workspace.DormantAt.Valid == req.Dormant {
930-
rw.WriteHeader(http.StatusNotModified)
930+
httpapi.Write(ctx, rw, http.StatusNotModified, codersdk.Response{
931+
Message: "Nothing to do!",
932+
})
931933
return
932934
}
933935

docs/api/users.md

Lines changed: 31 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)