From 331dd58b658770e2860db327c0e398d285ce5cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Wed, 6 Nov 2024 11:15:58 +0100 Subject: [PATCH] Revert "internal/rest: Update Render and pass request" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bda756d1827bc808cb4c01950624f9c260df2e0c. Signed-off-by: Julian Pelizäus --- internal/rest/rest.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/rest/rest.go b/internal/rest/rest.go index e1399fbf..2991b3ae 100644 --- a/internal/rest/rest.go +++ b/internal/rest/rest.go @@ -53,7 +53,7 @@ func handleAPIRequest(action rest.EndpointAction, state state.State, w http.Resp } if resp != nil { - err := resp.Render(w, r) + err := resp.Render(w) if err != nil { return response.InternalError(err) } @@ -194,7 +194,7 @@ func HandleEndpoint(state state.State, mux *mux.Router, version string, e rest.E intState, err := internalState.ToInternal(state) if err != nil { - err := response.BadRequest(err).Render(w, r) + err := response.BadRequest(err).Render(w) if err != nil { logger.Error("Failed to write HTTP response", logger.Ctx{"url": r.URL, "err": err}) } @@ -204,7 +204,7 @@ func HandleEndpoint(state state.State, mux *mux.Router, version string, e rest.E // Return Unavailable Error (503) if daemon is shutting down, except for endpoints with AllowedDuringShutdown. if intState.Context.Err() == context.Canceled && !e.AllowedDuringShutdown { - err := response.Unavailable(fmt.Errorf("Daemon is shutting down")).Render(w, r) + err := response.Unavailable(fmt.Errorf("Daemon is shutting down")).Render(w) if err != nil { logger.Error("Failed to write HTTP response", logger.Ctx{"url": r.URL, "err": err}) } @@ -215,7 +215,7 @@ func HandleEndpoint(state state.State, mux *mux.Router, version string, e rest.E if !e.AllowedBeforeInit { err := state.Database().IsOpen(r.Context()) if err != nil { - err := response.SmartError(err).Render(w, r) + err := response.SmartError(err).Render(w) if err != nil { logger.Error("Failed to write HTTP response", logger.Ctx{"url": r.URL, "err": err}) } @@ -259,9 +259,9 @@ func HandleEndpoint(state state.State, mux *mux.Router, version string, e rest.E // we can ensure that the connection wasn't yet hijacked and the actual error // can be safely returned to the caller. if e.Path != "database" || (e.Path == "database" && resp != response.EmptySyncResponse) { - err := resp.Render(w, r) + err := resp.Render(w) if err != nil { - err := response.InternalError(err).Render(w, r) + err := response.InternalError(err).Render(w) if err != nil { logger.Error("Failed writing error for HTTP response", logger.Ctx{"url": url, "error": err}) }