doForwardProxyRequest sends a request through the proxy in forward-proxy form (absolute URI in the request line). httptest's serve path preserves the URL.Host and URL.Scheme when we construct the request this way.
(proxy *CacheProxy, method, absoluteURL string, headers http.Header)
| 110 | } |
| 111 | |
| 112 | // newTestProxy wires a CacheProxy with no peers and a tempdir-backed store. |
| 113 | func newTestProxy(t *testing.T) *CacheProxy { |
| 114 | t.Helper() |
| 115 | proxy := NewCacheProxy(newTestCache(t), nil, nil) |
| 116 | proxy.originRetryInitialBackoff = 0 |
| 117 | proxy.originRetryMaxBackoff = 0 |
| 118 | return proxy |
| 119 | } |
| 120 | |
| 121 | // newTestServer returns an httptest origin plus a proxy that rewrites inbound |
| 122 | // forward-proxy-style requests to target that origin. DuckDB sends absolute-form |
| 123 | // URIs (scheme + host + path); we give the test the origin's URL so the proxy's |
| 124 | // fetchOrigin hits httptest.Server directly. |
| 125 | func newTestServer(t *testing.T, handler http.HandlerFunc) (*httptest.Server, string) { |
| 126 | t.Helper() |
no test coverage detected