Skip to content

Commit

Permalink
fix: compressed option should be false by default (#567)
Browse files Browse the repository at this point in the history
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 -->
  • Loading branch information
n8han authored Dec 20, 2024
1 parent 31b5d81 commit a0a8dc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ console.log('status: %s, body size: %d, headers: %j', res.status, data.length, r
- ***formatRedirectUrl*** Function - Format the redirect url by your self. Default is `url.resolve(from, to)`.
- ***beforeRequest*** Function - Before request hook, you can change every thing here.
- ***streaming*** Boolean - let you get the `res` object when request connected, default `false`. alias `customResponse`
- ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `true`.
- ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
- ***timing*** Boolean - Enable timing or not, default is `true`.
- ***socketPath*** String | null - request a unix socket service, default is `null`.
- ***highWaterMark*** Number - default is `67108864`, 64 KiB.
Expand Down
2 changes: 1 addition & 1 deletion src/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export type RequestOptions = {
formatRedirectUrl?: (a: any, b: any) => void;
/** Before request hook, you can change every thing here. */
beforeRequest?: (...args: any[]) => void;
/** Accept `gzip, br` response content and auto decode it, default is `true`. */
/** Accept `gzip, br` response content and auto decode it, default is `false`. */
compressed?: boolean;
/**
* @deprecated
Expand Down

0 comments on commit a0a8dc5

Please sign in to comment.