set temp file limiter for buffered body

This commit is contained in:
WeidiDeng 2024-10-17 15:58:53 +08:00
parent 02b8640e44
commit 7d483ff3ef
No known key found for this signature in database
GPG key ID: 25F87CE1741EC7CD

View file

@ -239,6 +239,7 @@ func (t Transport) bufferBody(req io.Reader) (int64, io.ReadCloser, error) {
size, err := io.CopyN(memBuf, req, t.BodyBufferMemoryLimit) size, err := io.CopyN(memBuf, req, t.BodyBufferMemoryLimit)
var body bufferedBody // should be closed in case buffering fails var body bufferedBody // should be closed in case buffering fails
body.memBuf = memBuf body.memBuf = memBuf
body.tempFileLimiter = t.tempFileLimiter
// error while reading the body // error while reading the body
if err != nil { if err != nil {
// fully buffered in memory // fully buffered in memory