From f2dfccc58ee786f29a6c5251e53a9e5628d37f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Wed, 6 Nov 2024 11:15:49 +0100 Subject: [PATCH] Revert "internal/rest/resources: Update Render and pass request" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8ba6b4f2cc38172a51da1d06303944955278ef17. Signed-off-by: Julian Pelizäus --- internal/rest/resources/cluster.go | 6 +++--- internal/rest/resources/hooks_test.go | 8 ++------ internal/rest/resources/shutdown.go | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/rest/resources/cluster.go b/internal/rest/resources/cluster.go index f1a62d7b..264bdd70 100644 --- a/internal/rest/resources/cluster.go +++ b/internal/rest/resources/cluster.go @@ -328,7 +328,7 @@ func clusterMemberPut(s state.State, r *http.Request) response.Response { go reExec() return response.ManualResponse(func(w http.ResponseWriter) error { - err := response.EmptySyncResponse.Render(w, r) + err := response.EmptySyncResponse.Render(w) if err != nil { return err } @@ -448,7 +448,7 @@ func clusterMemberDelete(s state.State, r *http.Request) response.Response { } return response.ManualResponse(func(w http.ResponseWriter) error { - err := response.EmptySyncResponse.Render(w, r) + err := response.EmptySyncResponse.Render(w) if err != nil { return err } @@ -566,7 +566,7 @@ func clusterMemberDelete(s state.State, r *http.Request) response.Response { } return response.ManualResponse(func(w http.ResponseWriter) error { - err := response.EmptySyncResponse.Render(w, r) + err := response.EmptySyncResponse.Render(w) if err != nil { return err } diff --git a/internal/rest/resources/hooks_test.go b/internal/rest/resources/hooks_test.go index e84d9ba6..ccc88de7 100644 --- a/internal/rest/resources/hooks_test.go +++ b/internal/rest/resources/hooks_test.go @@ -7,7 +7,6 @@ import ( "io" "net/http" "net/http/httptest" - "net/url" "strings" "testing" @@ -117,10 +116,7 @@ func (t *hooksSuite) Test_hooks() { ranHook = "" isForce = false expectForce := false - req := &http.Request{ - // Set an URL for response.Render to not cause any panic. - URL: &url.URL{}, - } + req := &http.Request{} payload, ok := c.req.(internalTypes.HookRemoveMemberOptions) if !ok { payload, ok := c.req.(internalTypes.HookNewMemberOptions) @@ -135,7 +131,7 @@ func (t *hooksSuite) Test_hooks() { response := hooksPost(s, req) recorder := httptest.NewRecorder() - err := response.Render(recorder, req) + err := response.Render(recorder) require.NoError(t.T(), err) var resp api.Response diff --git a/internal/rest/resources/shutdown.go b/internal/rest/resources/shutdown.go index c33e8e78..bc3beb84 100644 --- a/internal/rest/resources/shutdown.go +++ b/internal/rest/resources/shutdown.go @@ -38,7 +38,7 @@ func shutdownPost(state state.State, r *http.Request) response.Response { // Run shutdown sequence synchronously. exit, stopErr := intState.Stop() - err := response.SmartError(stopErr).Render(w, r) + err := response.SmartError(stopErr).Render(w) if err != nil { return err }