Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcc9b05

Browse files
authored
fix: return http 204 on test notification (#16651)
This PR changes the API response for `/api/v2/notifications/test` endpoint to HTTP 204 / No Content.
1 parent d50e846 commit fcc9b05

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

coderd/notifications.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (api *API) postTestNotification(rw http.ResponseWriter, r *http.Request) {
210210
return
211211
}
212212

213-
httpapi.Write(ctx, rw, http.StatusOK, nil)
213+
rw.WriteHeader(http.StatusNoContent)
214214
}
215215

216216
// @Summary Get user notification preferences

codersdk/notifications.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,9 @@ func (c *Client) PostTestNotification(ctx context.Context) error {
200200
}
201201
defer res.Body.Close()
202202

203-
if res.StatusCode != http.StatusOK {
203+
if res.StatusCode != http.StatusNoContent {
204204
return ReadBodyAsError(res)
205205
}
206-
207206
return nil
208207
}
209208

0 commit comments

Comments
 (0)