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

Function TestHandleProxyForwardsOrigin416Verbatim

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

TestHandleProxyForwardsOrigin416Verbatim: Range Not Satisfiable carries semantically important metadata for DuckLake; collapsing to 502 made it look like a network error.

(t *testing.T)

Source from the content-addressed store, hash-verified

692 }
693
694 for _, tt := range tests {
695 t.Run(tt.name, func(t *testing.T) {
696 proxy := newTestProxy(t)
697 var calls int32
698 _, originURL := newTestServer(t, func(w http.ResponseWriter, r *http.Request) {
699 atomic.AddInt32(&calls, 1)
700 w.WriteHeader(tt.status)
701 _, _ = fmt.Fprintf(w, "status=%d", tt.status)
702 })
703
704 rec := doForwardProxyRequest(proxy, "GET", originURL+"/bucket/terminal.parquet", http.Header{"Range": []string{"bytes=0-1"}})
705 if rec.Code != tt.status {
706 t.Fatalf("status = %d, want %d", rec.Code, tt.status)
707 }
708 if atomic.LoadInt32(&calls) != 1 {
709 t.Fatalf("origin calls = %d, want 1 for terminal status %d", calls, tt.status)
710 }

Callers

nothing calls this directly

Calls 5

newTestProxyFunction · 0.85
newTestServerFunction · 0.85
doForwardProxyRequestFunction · 0.85
HeaderMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected