MCPcopy
hub / github.com/keploy/keploy / writeBadRequest

Function writeBadRequest

pkg/agent/proxy/incoming/http.go:1005–1007  ·  view source on GitHub ↗

writeBadRequest is the client-side counterpart to writeBadGateway: 400-class so the failure isn't misattributed to the upstream by downstream proxies / monitoring. Used when we detect a malformed or truncated request from the downstream client (e.g., Content-Length mismatch during replay-safety pre-

(c net.Conn)

Source from the content-addressed store, hash-verified

1003// or truncated request from the downstream client (e.g.,
1004// Content-Length mismatch during replay-safety pre-buffering).
1005func writeBadRequest(c net.Conn) {
1006 _, _ = c.Write([]byte("HTTP/1.1 400 Bad Request\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"))
1007}
1008
1009// handleHttp1ZeroCopy handles HTTP/1.x connections in normal (non-sync) and
1010// sampling modes.

Callers 1

handleHttp1ZeroCopyMethod · 0.85

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected