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

Function newTestServer

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

newTestServer returns an httptest origin plus a proxy that rewrites inbound forward-proxy-style requests to target that origin. DuckDB sends absolute-form URIs (scheme + host + path); we give the test the origin's URL so the proxy's fetchOrigin hits httptest.Server directly.

(t *testing.T, handler http.HandlerFunc)

Source from the content-addressed store, hash-verified

99
100func (b *syncBuffer) Write(p []byte) (int, error) {
101 b.mu.Lock()
102 defer b.mu.Unlock()
103 return b.buf.Write(p)
104}
105
106func (b *syncBuffer) String() string {
107 b.mu.Lock()
108 defer b.mu.Unlock()
109 return b.buf.String()
110}

Calls

no outgoing calls

Tested by

no test coverage detected