MCPcopy
hub / github.com/valyala/fasthttp / BodyUncompressedWithLimit

Method BodyUncompressedWithLimit

http.go:703–718  ·  view source on GitHub ↗

BodyUncompressedWithLimit returns body data and if needed decompresses it from gzip, deflate, brotli or zstd. The size of uncompressed data is limited to maxBodySize bytes. If maxBodySize <= 0, then no limit is applied.

(maxBodySize int)

Source from the content-addressed store, hash-verified

701//
702// If maxBodySize <= 0, then no limit is applied.
703func (resp *Response) BodyUncompressedWithLimit(maxBodySize int) ([]byte, error) {
704 switch string(resp.Header.ContentEncoding()) {
705 case "":
706 return resp.Body(), nil
707 case "deflate":
708 return resp.BodyInflateWithLimit(maxBodySize)
709 case "gzip":
710 return resp.BodyGunzipWithLimit(maxBodySize)
711 case "br":
712 return resp.BodyUnbrotliWithLimit(maxBodySize)
713 case "zstd":
714 return resp.BodyUnzstdWithLimit(maxBodySize)
715 default:
716 return nil, ErrContentEncodingUnsupported
717 }
718}
719
720// BodyWriteTo writes request body to w.
721func (req *Request) BodyWriteTo(w io.Writer) error {

Callers 2

BodyUncompressedMethod · 0.95

Calls 6

BodyMethod · 0.95
BodyInflateWithLimitMethod · 0.95
BodyGunzipWithLimitMethod · 0.95
BodyUnbrotliWithLimitMethod · 0.95
BodyUnzstdWithLimitMethod · 0.95
ContentEncodingMethod · 0.45

Tested by 1