MCPcopy Create free account
hub / github.com/coder/coder / bufferBody

Function bufferBody

aibridge/keypool/failover.go:111–117  ·  view source on GitHub ↗

bufferBody reads the request body fully so it can be replayed across key-failover retries. Returns nil for a nil body.

(req *http.Request)

Source from the content-addressed store, hash-verified

109// bufferBody reads the request body fully so it can be replayed
110// across key-failover retries. Returns nil for a nil body.
111func bufferBody(req *http.Request) ([]byte, error) {
112 if req.Body == nil {
113 return nil, nil
114 }
115 defer req.Body.Close()
116 return io.ReadAll(req.Body)
117}

Callers 1

RoundTripMethod · 0.85

Calls 2

CloseMethod · 0.65
ReadAllMethod · 0.45

Tested by

no test coverage detected