MCPcopy
hub / github.com/cortexlabs/cortex / TestNewReverseProxy

Function TestNewReverseProxy

pkg/proxy/proxy_test.go:30–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNewReverseProxy(t *testing.T) {
31 var isHandlerCalled bool
32 var handler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
33 isHandlerCalled = true
34 }
35
36 server := httptest.NewServer(handler)
37 httpProxy := proxy.NewReverseProxy(server.URL, 1000, 1000)
38
39 resp := httptest.NewRecorder()
40 req := httptest.NewRequest(http.MethodPost, "http://user-container.cortex.dev", nil)
41 httpProxy.ServeHTTP(resp, req)
42
43 require.True(t, isHandlerCalled)
44}

Callers

nothing calls this directly

Calls 2

NewReverseProxyFunction · 0.92
ServeHTTPMethod · 0.45

Tested by

no test coverage detected