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)
| 221 | // expectRoutedTo asserts the proxy MITM'd the request and forwarded it |
| 222 | // to aibridged with the expected /api/v2/aibridge/<name>/<path>. |
| 223 | func (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 |
no test coverage detected