startServer creates an httptest server with the WS handler mounted on a mux router.
(t *testing.T, handler *Handler)
| 63 | |
| 64 | // startServer creates an httptest server with the WS handler mounted on a mux router. |
| 65 | func startServer(t *testing.T, handler *Handler) *httptest.Server { |
| 66 | t.Helper() |
| 67 | r := mux.NewRouter() |
| 68 | r.HandleFunc("/api/v1/agents/{email}/ws", handler.Handle) |
| 69 | srv := httptest.NewServer(r) |
| 70 | t.Cleanup(srv.Close) |
| 71 | return srv |
| 72 | } |
| 73 | |
| 74 | // dialWSPath connects to a specific WS path on the test server, authenticating |
| 75 | // with the Authorization: Bearer header (the credential is never in the URL). |
no test coverage detected