MCPcopy
hub / github.com/dosco/graphjin / newWebSocketTestServer

Function newWebSocketTestServer

serv/ws_test.go:16–39  ·  view source on GitHub ↗
(t *testing.T, allowedOrigins []string)

Source from the content-addressed store, hash-verified

14)
15
16func newWebSocketTestServer(t *testing.T, allowedOrigins []string) *httptest.Server {
17 t.Helper()
18
19 logger := zap.NewNop()
20 svc := &graphjinService{
21 conf: &Config{
22 Serv: Serv{
23 AllowedOrigins: allowedOrigins,
24 },
25 },
26 log: logger.Sugar(),
27 zlog: logger,
28 }
29
30 hs := &HttpService{}
31 hs.Store(svc)
32
33 ah, err := auth.NewAuthHandlerFunc(auth.Auth{Type: "none"})
34 if err != nil {
35 t.Fatalf("new auth handler: %v", err)
36 }
37
38 return httptest.NewServer(hs.GraphQL(ah))
39}
40
41func dialWS(ctx context.Context, t *testing.T, url string, header http.Header) (*websocket.Conn, *http.Response, error) {
42 t.Helper()

Calls 1

GraphQLMethod · 0.95

Tested by

no test coverage detected