MCPcopy Create free account
hub / github.com/coder/coder / expectRoutedTo

Method expectRoutedTo

enterprise/aibridgeproxyd/reload_test.go:223–233  ·  view source on GitHub ↗

expectRoutedTo asserts the proxy MITM'd the request and forwarded it to aibridged with the expected /api/v2/aibridge/ / .

(t *testing.T, targetURL, expectedPath string)

Source from the content-addressed store, hash-verified

221// expectRoutedTo asserts the proxy MITM'd the request and forwarded it
222// to aibridged with the expected /api/v2/aibridge/<name>/<path>.
223func (h *reloadTestHarness) expectRoutedTo(t *testing.T, targetURL, expectedPath string) {
224 t.Helper()
225
226 h.recorder.reset()
227 res := h.sendRequest(t, targetURL)
228 require.NoError(t, res.err, "request to routed host must succeed")
229 require.Equal(t, http.StatusOK, res.status)
230 require.Equal(t, "aibridged", res.body)
231 require.Equal(t, expectedPath, h.recorder.load(),
232 "aibridged must observe the rewritten path for %s", targetURL)
233}
234
235// expectNotRouted asserts the proxy did not MITM the request for the
236// given host. The CONNECT either falls through to the tunneled path

Calls 5

sendRequestMethod · 0.95
loadMethod · 0.80
HelperMethod · 0.65
resetMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected