Skip to content

Conversation

WooWan
Copy link
Contributor

@WooWan WooWan commented Jun 27, 2025

Summary

  • Add support for HTTP 307 (Temporary Redirect) and 308 (Permanent Redirect) status codes in the redirect handling logic

Changes

  • Add support for HTTP 307 (Temporary Redirect) and 308 (Permanent Redirect) status codes to handle redirects from our private registry.
  • Ensures proper handling of all standard HTTP redirect status codes

We've already handled 301 and 302, so it will be fine!


Important

Add support for HTTP 307 and 308 redirect status codes in fetch() in src/index.ts.

  • Behavior:
    • Update fetch() in src/index.ts to handle HTTP 307 and 308 status codes in addition to 301 and 302.
    • Ensures proper handling of all standard HTTP redirect status codes.

This description was created by Ellipsis for 6092ba5. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of HTTP redirects to support additional status codes, ensuring smoother navigation and resource loading.

Copy link

changeset-bot bot commented Jun 27, 2025

⚠️ No Changeset found

Latest commit: f337a38

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Jun 27, 2025

Walkthrough

The HTTP redirect status codes handled in the fetch function within src/index.ts were consolidated into a single constant REDIRECT_STATUS_CODES as a Set containing 301, 302, 307, and 308. The code now checks membership in this set to decide on following redirects.

Changes

File(s) Change Summary
src/index.ts Refactored redirect status code checks in fetch to use a Set constant for 301, 302, 307, 308
.changeset/calm-avocados-invite.md Added changeset documenting patch update for handling HTTP redirect status codes 307 and 308

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Fetch
    participant Server

    Caller->>Fetch: fetch(url)
    Fetch->>Server: HTTP request
    Server-->>Fetch: HTTP response (status 301/302/307/308 with Location)
    alt Redirect status and Location header present
        Fetch->>Fetch: fetch(new Location URL) (recursive)
    else Non-redirect or no Location
        Fetch-->>Caller: Return response
    end
Loading

Poem

In the warren of code, redirects abound,
Now 307 and 308 are also tracked down.
Hop after hop, the fetch bunnies dash,
Following headers in a redirect flash.
With every new path, the journey extends—
Until at last, the trail ends!
🐇🌐

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/index.ts

Oops! Something went wrong! :(

ESLint: 9.30.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between aab75e3 and d50bdc1.

📒 Files selected for processing (2)
  • .changeset/calm-avocados-invite.md (1 hunks)
  • src/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/calm-avocados-invite.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 on ubuntu-latest
  • GitHub Check: publish
  • GitHub Check: Package Size Report
  • GitHub Check: size-limit
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 6092ba5 in 1 minute and 7 seconds. Click for details.
  • Reviewed 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/index.ts:29
  • Draft comment:
    Consider using an array with .includes() for cleaner redirect status checks.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. src/index.ts:35
  • Draft comment:
    Consider resolving relative redirect URLs and imposing a max redirect limit to avoid potential infinite recursion.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_z1Z7TCitbXXnfo4N

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@WooWan WooWan requested a review from JounQin June 28, 2025 15:08
@JounQin JounQin changed the title update: handle 307 and 308 redirect status codes feat: handle 307 and 308 redirect status codes Jun 28, 2025
JounQin added 2 commits June 29, 2025 00:47
Signed-off-by: JounQin <admin@1stg.me>
Signed-off-by: JounQin <admin@1stg.me>
Copy link

pkg-pr-new bot commented Jun 28, 2025

Open in StackBlitz

npm i https://pkg.pr.new/napi-postinstall@38

commit: d50bdc1

@JounQin JounQin merged commit 76b34bd into un-ts:main Jun 28, 2025
18 checks passed
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