Remove API Middleware (#13243)

* remove api/gateway/apimiddleware

* fix errors in api/gateway

* remove beacon-chain/rpc/apimiddleware

* fix errors in api/client/beacon

* fix errors in validator/client/beacon-api

* fix errors in beacon-chain/node

* fix errors in validator/node

* fix errors in cmd/prysmctl/validator

* fix errors in testing/endtoend

* fix all other code

* remove comment

* fix tests

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2023-12-04 12:55:21 +01:00
committed by GitHub
parent b68a4e12aa
commit a0ca4a67b0
78 changed files with 901 additions and 3956 deletions

View File

@@ -40,7 +40,6 @@ go_library(
],
deps = [
"//api/gateway:go_default_library",
"//api/gateway/apimiddleware:go_default_library",
"//api/server:go_default_library",
"//async/event:go_default_library",
"//cmd:go_default_library",

View File

@@ -27,7 +27,6 @@ import (
"github.com/pkg/errors"
fastssz "github.com/prysmaticlabs/fastssz"
"github.com/prysmaticlabs/prysm/v4/api/gateway"
"github.com/prysmaticlabs/prysm/v4/api/gateway/apimiddleware"
"github.com/prysmaticlabs/prysm/v4/api/server"
"github.com/prysmaticlabs/prysm/v4/async/event"
"github.com/prysmaticlabs/prysm/v4/cmd"
@@ -814,7 +813,7 @@ func (c *ValidatorClient) registerRPCGatewayService(router *mux.Router) error {
gwruntime.WithForwardResponseOption(gateway.HttpResponseModifier),
)
muxHandler := func(_ *apimiddleware.ApiProxyMiddleware, h http.HandlerFunc, w http.ResponseWriter, req *http.Request) {
muxHandler := func(h http.HandlerFunc, w http.ResponseWriter, req *http.Request) {
// The validator gateway handler requires this special logic as it serves the web APIs and the web UI.
if strings.HasPrefix(req.URL.Path, "/api") {
req.URL.Path = strings.Replace(req.URL.Path, "/api", "", 1)