Skip to content

Commit

Permalink
Revert "internal/rest/resources: Update Render and pass request"
Browse files Browse the repository at this point in the history
This reverts commit 8ba6b4f.

Signed-off-by: Julian Pelizäus <[email protected]>
  • Loading branch information
roosterfish committed Nov 6, 2024
1 parent 46b1549 commit f2dfccc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions internal/rest/resources/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 2 additions & 6 deletions internal/rest/resources/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"io"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/rest/resources/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f2dfccc

Please sign in to comment.