MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / newTestHTTPServer

Function newTestHTTPServer

pkg/mcp/server_integration_test.go:26–33  ·  view source on GitHub ↗
(t *testing.T, authToken string)

Source from the content-addressed store, hash-verified

24)
25
26func newTestHTTPServer(t *testing.T, authToken string) *httptest.Server {
27 t.Helper()
28 cfg := &Config{Host: "127.0.0.1", Port: 8080, AuthToken: authToken}
29 srv := New(cfg)
30 streamSrv := mcpserver.NewStreamableHTTPServer(srv.mcpSrv)
31 wrapped := BearerAuthMiddleware(cfg, streamSrv)
32 return httptest.NewServer(wrapped)
33}
34
35func TestIntegration_AuthRequired_NoToken(t *testing.T) {
36 ts := newTestHTTPServer(t, "secret-token")

Calls 3

BearerAuthMiddlewareFunction · 0.85
NewFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected