From f66e802faea39fe77b0bf2777faa54ce6f049271 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 5 Dec 2023 19:06:56 +0000 Subject: [PATCH] fix(coderd/debug): putDeploymentHealthSettings: use 204 instead of 304 if not modified (#11048) --- coderd/debug.go | 3 ++- codersdk/health.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/coderd/debug.go b/coderd/debug.go index 8f61bcfb78..d447de36ef 100644 --- a/coderd/debug.go +++ b/coderd/debug.go @@ -205,7 +205,8 @@ func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Requ } if bytes.Equal(settingsJSON, []byte(currentSettingsJSON)) { - httpapi.Write(r.Context(), rw, http.StatusNotModified, nil) + // See: https://www.rfc-editor.org/rfc/rfc7231#section-6.3.5 + httpapi.Write(r.Context(), rw, http.StatusNoContent, nil) return } diff --git a/codersdk/health.go b/codersdk/health.go index b2a7b3de73..7367df902f 100644 --- a/codersdk/health.go +++ b/codersdk/health.go @@ -36,7 +36,7 @@ func (c *Client) PutHealthSettings(ctx context.Context, settings HealthSettings) } defer res.Body.Close() - if res.StatusCode == http.StatusNotModified { + if res.StatusCode == http.StatusNoContent { return xerrors.New("health settings not modified") } if res.StatusCode != http.StatusOK {