From 592d444630393ef0888e68365869ef4f5ce8238a Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 5 Aug 2024 13:34:17 -0500 Subject: [PATCH 1/2] chore: delete user codersdk to support status code regression --- codersdk/users.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codersdk/users.go b/codersdk/users.go index 4de5457edc5ec..90c2845e372f8 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -309,7 +309,11 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error { return err } defer res.Body.Close() - if res.StatusCode != http.StatusOK { + // Check for both status codes, there was a release that changed this response + // to StatusNoContent. To be compatible with that, the second condition is + // included. + // The 'http.StatusNoContent' check can be removed in 2025 + if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNoContent { return ReadBodyAsError(res) } return nil From 5926e7bd85d89fc4774355bb6285571c17d94b36 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Wed, 7 Aug 2024 11:04:27 -0500 Subject: [PATCH 2/2] Update codersdk/users.go Co-authored-by: Kayla Washburn-Love --- codersdk/users.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/codersdk/users.go b/codersdk/users.go index 90c2845e372f8..a715194c11978 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -309,10 +309,8 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error { return err } defer res.Body.Close() - // Check for both status codes, there was a release that changed this response - // to StatusNoContent. To be compatible with that, the second condition is - // included. - // The 'http.StatusNoContent' check can be removed in 2025 + // Check for a 200 or a 204 response. 2.14.0 accidentally included a 204 response, + // which was a breaking change, and reverted in 2.14.1. if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNoContent { return ReadBodyAsError(res) }