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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy