@@ -101,8 +101,8 @@ body yourself.
101101
102102* ` opts` {Object} (optional)
103103 * ` maxSize` {number} Maximum number of bytes to read and discard. Responses
104- whose ` Content - Length ` exceeds this value are aborted. **Default:**
105- ` 1_048_576 ` (1 MiB).
104+ whose declared or received body size exceeds this value are aborted.
105+ **Default:** ` 1_048_576 ` (1 MiB).
106106
107107Per-request override: set ` dumpMaxSize` on the dispatch options to override
108108the global ` maxSize` for a specific request.
@@ -210,6 +210,9 @@ Automatically decompresses response bodies encoded with `gzip`, `x-gzip`,
210210 skipped. **Default:** ` [204 , 304 ]` .
211211 * ` skipErrorResponses` {boolean} When ` true ` , responses with a status code
212212 >= 400 are not decompressed. **Default:** ` true ` .
213+ * ` maxSize` {number} Maximum decompressed response size in bytes. The request
214+ fails with a ` ResponseExceededMaxSizeError` if the decoded body exceeds
215+ this limit. **Default:** ` 67108864 ` (64 MiB).
213216
214217**Returns:** {Dispatcher.DispatcherComposeInterceptor}
215218
@@ -221,7 +224,8 @@ import { Agent, interceptors } from 'undici'
221224const agent = new Agent ().compose (
222225 interceptors .decompress ({
223226 skipStatusCodes: [204 , 304 ],
224- skipErrorResponses: false // decompress error bodies too
227+ skipErrorResponses: false , // decompress error bodies too
228+ maxSize: 16 * 1024 * 1024 // limit decoded bodies to 16 MiB
225229 })
226230)
227231` ` `
0 commit comments