Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compressed option should be false by default #567

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

n8han
Copy link
Contributor

@n8han n8han commented Dec 19, 2024

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.

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.

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.
Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

The pull request introduces changes to the urllib package's documentation and type definitions. The primary modification is adjusting the default behavior of the compressed option in the async request() method from true to false. This means that response content will no longer be automatically decoded by default, requiring users to explicitly enable compression decoding. Additionally, the ctx property in the RequestOptions type is marked as deprecated, with a recommendation to use the opaque property instead.

Changes

File Change Summary
README.md Updated documentation for async request() method, changing compressed default value from true to false
src/Request.ts Modified RequestOptions type:
- compressed default value changed to false
- ctx property marked as deprecated

Poem

🐰 A Rabbit's Compression Tale 🔍

No more auto-decode, my dear friend,
Compression's default has met its end
Explicit is key, set it with care
compressed: true if you dare!
A small change that makes requests quite fair

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

76-76: Add hyphen in "auto-decode" for better grammar.

Consider adding a hyphen between "auto" and "decode" as it forms a compound modifier.

-  - ***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
+  - ***compressed*** Boolean - Accept `gzip, br` response content and auto-decode it, default is `false`.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~76-~76: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ... Accept gzip, br response content and auto decode it, default is false. - *timing...

(AUTO_HYPHEN)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31b5d81 and 6c4b87d.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • src/Request.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~76-~76: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ... Accept gzip, br response content and auto decode it, default is false. - *timing...

(AUTO_HYPHEN)

🔇 Additional comments (2)
src/Request.ts (1)

108-108: LGTM! Documentation accurately reflects the default behavior.

The updated documentation correctly states that the compressed option defaults to false, which aligns with the actual implementation.

README.md (1)

76-76: LGTM! Documentation is consistent with the type definition.

The updated documentation in README.md correctly reflects that the compressed option defaults to false, maintaining consistency with the type definition in src/Request.ts.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~76-~76: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ... Accept gzip, br response content and auto decode it, default is false. - *timing...

(AUTO_HYPHEN)

@n8han
Copy link
Contributor Author

n8han commented Dec 19, 2024

You'll find my PR easier to follow if you ignore the AI summary, which is longer than the change set, and wrong 😂

Copy link

pkg-pr-new bot commented Dec 20, 2024

Open in Stackblitz

npm i https://pkg.pr.new/node-modules/urllib@567

commit: 6c4b87d

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.70%. Comparing base (54c4a2c) to head (6c4b87d).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #567   +/-   ##
=======================================
  Coverage   95.70%   95.70%           
=======================================
  Files          11       11           
  Lines        1282     1282           
  Branches      309      310    +1     
=======================================
  Hits         1227     1227           
  Misses         51       51           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fengmk2 fengmk2 changed the title Fix documentation for compressed option fix: compressed option should be false by default Dec 20, 2024
@fengmk2 fengmk2 merged commit a0a8dc5 into node-modules:master Dec 20, 2024
26 checks passed
@fengmk2
Copy link
Member

fengmk2 commented Dec 20, 2024

@n8han Thanks ❤️

fengmk2 pushed a commit that referenced this pull request Dec 20, 2024
[skip ci]

## [4.6.11](v4.6.10...v4.6.11) (2024-12-20)

### Bug Fixes

* compressed option should be false by default ([#567](#567)) ([a0a8dc5](a0a8dc5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants