MCPcopy Create free account
hub / github.com/PostHog/duckgres / doForwardProxyRequest

Function doForwardProxyRequest

cmd/cache-proxy/proxy_test.go:112–123  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

110}
111
112// newTestProxy wires a CacheProxy with no peers and a tempdir-backed store.
113func 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.
125func newTestServer(t *testing.T, handler http.HandlerFunc) (*httptest.Server, string) {
126 t.Helper()

Calls 2

AddMethod · 0.80
HandleProxyMethod · 0.80

Tested by

no test coverage detected