Skip to content

Commit a0a8dc5

Browse files
authored
fix: compressed option should be false by default (#567)
The `compressed` option is not enabled by default. There is no code setting it to true, except where the old `gzip` property is true. I confirmed this behavior in testing. The documentation for it appears to have been inadvertently updated when the `timing` option was added in commit 1d26bb8. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated `README.md` to reflect the change in default value for the `compressed` option in the `async request(url[, options])` method from `true` to `false`. - **Bug Fixes** - Changed the default behavior of the `compressed` property in request handling to prevent automatic decoding of `gzip` and `br` responses unless specified by the user. - **Chores** - Deprecated the `ctx` property in `RequestOptions`, recommending the use of the `opaque` property instead. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 31b5d81 commit a0a8dc5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ console.log('status: %s, body size: %d, headers: %j', res.status, data.length, r
7373
- ***formatRedirectUrl*** Function - Format the redirect url by your self. Default is `url.resolve(from, to)`.
7474
- ***beforeRequest*** Function - Before request hook, you can change every thing here.
7575
- ***streaming*** Boolean - let you get the `res` object when request connected, default `false`. alias `customResponse`
76-
- ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `true`.
76+
- ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
7777
- ***timing*** Boolean - Enable timing or not, default is `true`.
7878
- ***socketPath*** String | null - request a unix socket service, default is `null`.
7979
- ***highWaterMark*** Number - default is `67108864`, 64 KiB.

src/Request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export type RequestOptions = {
105105
formatRedirectUrl?: (a: any, b: any) => void;
106106
/** Before request hook, you can change every thing here. */
107107
beforeRequest?: (...args: any[]) => void;
108-
/** Accept `gzip, br` response content and auto decode it, default is `true`. */
108+
/** Accept `gzip, br` response content and auto decode it, default is `false`. */
109109
compressed?: boolean;
110110
/**
111111
* @deprecated

0 commit comments

Comments
 (0)