HTTP: don't drain GET request bodies (#28085)

This commit is contained in:
andig 2026-03-10 11:56:17 +01:00 • committed by GitHub
parent 0e285dd7d0
commit 5d528fa738
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -108,7 +108,7 @@ func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
bld.WriteString("\n")
bld.Write(bytes.TrimSpace(body[:min(LogMaxLen, len(body))]))
}
} else {
} else if req.Method != http.MethodGet {
if save, req.Body, err = drainBody(req.Body); err == nil {
err = dump(save, bld)
}
@ -130,7 +130,7 @@ func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
bld.WriteString("\n\n")
bld.Write(bytes.TrimSpace(body[:min(LogMaxLen, len(body))]))
}
} else {
} else if req.Method != http.MethodGet {
if save, resp.Body, err = drainBody(resp.Body); err == nil {
err = dump(save, bld)
}