diff --git a/internal/rpcgateway/rpcgateway_test.go b/internal/rpcgateway/rpcgateway_test.go index e6f58cf..f214451 100644 --- a/internal/rpcgateway/rpcgateway_test.go +++ b/internal/rpcgateway/rpcgateway_test.go @@ -3,7 +3,6 @@ package rpcgateway import ( "bytes" "context" - "fmt" "html/template" "io" "net/http" @@ -58,15 +57,11 @@ type TestURL struct { func TestRpcGatewayFailover(t *testing.T) { prometheus.DefaultRegisterer = prometheus.NewRegistry() - // RPC backends setup - onReq := func(r *http.Request) { - fmt.Println("got request") - } - rpcBackend := &responder{ - value: []byte(`{"jsonrpc":"2.0","id":1,"result":"0xd8d7df"}`), - onRequest: onReq, - } - ts := httptest.NewServer(rpcBackend) + ts := httptest.NewServer( + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(`{"jsonrpc":"2.0","id":1,"result":"0xd8d7df"}`)) + w.WriteHeader(http.StatusOK) + })) defer ts.Close() // Toxic Proxy setup diff --git a/internal/rpcgateway/test_utils.go b/internal/rpcgateway/test_utils.go deleted file mode 100644 index b43a68c..0000000 --- a/internal/rpcgateway/test_utils.go +++ /dev/null @@ -1,23 +0,0 @@ -package rpcgateway - -import ( - "net/http" -) - -type responder struct { - value []byte - onRequest func(*http.Request) -} - -func (r *responder) SetValue(value []byte) { - r.value = value -} - -func (r *responder) OnRequest(function func(*http.Request)) { - r.onRequest = function -} - -func (r *responder) ServeHTTP(w http.ResponseWriter, req *http.Request) { - r.onRequest(req) - w.Write(r.value) -}