From 22a37b2791624925daa020702db0307cd5c8dbfb Mon Sep 17 00:00:00 2001 From: Ray <153027766+RMNCLDYO@users.noreply.github.com> Date: Fri, 15 Aug 2025 16:37:24 -0400 Subject: [PATCH] feat(types): add decompress to fetch() (#21855) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- packages/bun-types/globals.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index ae8ab80d51..ab3685cfff 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -1888,6 +1888,25 @@ interface BunFetchRequestInit extends RequestInit { * ``` */ unix?: string; + + /** + * Control automatic decompression of the response body. + * When set to `false`, the response body will not be automatically decompressed, + * and the `Content-Encoding` header will be preserved. This can improve performance + * when you need to handle compressed data manually or forward it as-is. + * This is a custom property that is not part of the Fetch API specification. + * + * @default true + * @example + * ```js + * // Disable automatic decompression for a proxy server + * const response = await fetch("https://example.com/api", { + * decompress: false + * }); + * // response.headers.get('content-encoding') might be 'gzip' or 'br' + * ``` + */ + decompress?: boolean; } /**