Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: userw.WriteHeader to write responses without bodies#13870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 3 commits intomainfromno-ignored-body
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletionscoderd/apidoc/docs.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

8 changes: 2 additions & 6 deletionscoderd/apidoc/swagger.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletioncoderd/apikey.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -333,7 +333,7 @@ func (api *API) deleteAPIKey(rw http.ResponseWriter, r *http.Request) {
return
}

httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}

// @Summary Get token config
Expand Down
2 changes: 1 addition & 1 deletioncoderd/debug.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -235,7 +235,7 @@ func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Requ

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

Expand Down
2 changes: 1 addition & 1 deletioncoderd/externalauth.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -197,7 +197,7 @@ func (api *API) postExternalAuthDeviceByID(rw http.ResponseWriter, r *http.Reque
return
}
}
httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}

// @Summary Get external auth device by ID.
Expand Down
2 changes: 1 addition & 1 deletioncoderd/identityprovider/revoke.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,6 @@ func RevokeApp(db database.Store) http.HandlerFunc {
httpapi.InternalServerError(rw, err)
return
}
httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}
}
4 changes: 2 additions & 2 deletionscoderd/oauth2.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -207,7 +207,7 @@ func (api *API) deleteOAuth2ProviderApp(rw http.ResponseWriter, r *http.Request)
})
return
}
httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}

// @Summary Get OAuth2 application secrets.
Expand DownExpand Up@@ -324,7 +324,7 @@ func (api *API) deleteOAuth2ProviderAppSecret(rw http.ResponseWriter, r *http.Re
})
return
}
httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}

// @Summary OAuth2 authorization request.
Expand Down
2 changes: 1 addition & 1 deletioncoderd/templates.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -791,7 +791,7 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {

if updated.UpdatedAt.IsZero() {
aReq.New = template
httpapi.Write(ctx, rw,http.StatusNotModified, nil)
rw.WriteHeader(http.StatusNotModified)
return
}
aReq.New = updated
Expand Down
9 changes: 3 additions & 6 deletionscoderd/users.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -501,10 +501,9 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
// @Summary Delete user
// @ID delete-user
// @Security CoderSessionToken
// @Produce json
// @Tags Users
// @Param user path string true "User ID, name, or me"
// @Success200 {object} codersdk.User
// @Success204
// @Router /users/{user} [delete]
func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
Expand DownExpand Up@@ -558,9 +557,7 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
}
user.Deleted = true
aReq.New = user
httpapi.Write(ctx, rw, http.StatusOK, codersdk.Response{
Message: "User has been deleted!",
})
rw.WriteHeader(http.StatusNoContent)
}

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

httpapi.Write(ctx, rw,http.StatusNoContent, nil)
rw.WriteHeader(http.StatusNoContent)
}

// @Summary Get user roles
Expand Down
4 changes: 1 addition & 3 deletionscoderd/workspaces.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -927,9 +927,7 @@ func (api *API) putWorkspaceDormant(rw http.ResponseWriter, r *http.Request) {

// If the workspace is already in the desired state do nothing!
if workspace.DormantAt.Valid == req.Dormant {
httpapi.Write(ctx, rw, http.StatusNotModified, codersdk.Response{
Message: "Nothing to do!",
})
rw.WriteHeader(http.StatusNotModified)
return
}

Expand Down
2 changes: 1 addition & 1 deletioncodersdk/users.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -308,7 +308,7 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
if res.StatusCode != http.StatusNoContent {
return ReadBodyAsError(res)
}
return nil
Expand Down
34 changes: 3 additions & 31 deletionsdocs/api/users.md
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp