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

Function TestForwardUncachedPreservesQueryString

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

TestForwardUncachedPreservesQueryString covers AWS S3 multipart-upload query params (?uploads, ?partNumber=N&uploadId=...). Sigv4's canonical request includes the query string, so any mutation would 403.

(t *testing.T)

Source from the content-addressed store, hash-verified

1283// request. After the fix, the outbound request must carry over the inbound's
1284// ContentLength so the wire shape is preserved.
1285func TestForwardUncachedPropagatesContentLength(t *testing.T) {
1286 proxy := newTestProxy(t)
1287 payload := []byte("parquet-bytes-of-known-length")
1288
1289 var (
1290 gotMethod string
1291 gotContentLength int64
1292 gotTE string
1293 gotBody []byte
1294 )
1295 _, originURL := newTestServer(t, func(w http.ResponseWriter, r *http.Request) {
1296 gotMethod = r.Method
1297 gotContentLength = r.ContentLength
1298 gotTE = r.Header.Get("Transfer-Encoding")
1299 // httputil sometimes also strips Transfer-Encoding into r.TransferEncoding
1300 if gotTE == "" && len(r.TransferEncoding) > 0 {
1301 gotTE = strings.Join(r.TransferEncoding, ",")
1302 }
1303 gotBody, _ = io.ReadAll(r.Body)
1304 w.WriteHeader(http.StatusOK)
1305 })
1306

Callers

nothing calls this directly

Calls 3

newTestProxyFunction · 0.85
newTestServerFunction · 0.85
HandleProxyMethod · 0.80

Tested by

no test coverage detected