Skip to content

fix(fetch): set correct type for Response.redirect()#5212

Open
HiteshShonak wants to merge 1 commit intoboa-dev:mainfrom
HiteshShonak:fix/response-redirect-type
Open

fix(fetch): set correct type for Response.redirect()#5212
HiteshShonak wants to merge 1 commit intoboa-dev:mainfrom
HiteshShonak:fix/response-redirect-type

Conversation

@HiteshShonak
Copy link
Contributor

@HiteshShonak HiteshShonak commented Mar 21, 2026

This Pull Request fixes/closes #5211.

It changes the following:

  • Change ResponseType::Basic to ResponseType::Default in Response.redirect() - a new response type is "default" unless stated otherwise per the Fetch Standard.
  • Add a regression test asserting Response.redirect().type === "default".

Testing:

cargo test -p boa_runtime response -- --nocapture

Spec reference: https://fetch.spec.whatwg.org/#dom-response-redirect

@HiteshShonak HiteshShonak requested a review from a team as a code owner March 21, 2026 12:37
Copilot AI review requested due to automatic review settings March 21, 2026 12:37
@github-actions github-actions bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 21, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 21, 2026
@github-actions github-actions bot added C-Tests Issues and PRs related to the tests. C-Runtime Issues and PRs related to Boa's runtime features labels Mar 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns Boa’s Response.redirect() behavior with the Fetch Standard by ensuring newly created redirect responses have type === "default" (not "basic"), and adds a regression test to prevent reintroducing the bug reported in #5211.

Changes:

  • Update Response.redirect() to construct responses with ResponseType::Default.
  • Add a regression test asserting Response.redirect(...).type is "default" (with and without an explicit redirect status).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
core/runtime/src/fetch/response.rs Fixes Response.redirect() to set the response type to Default per spec.
core/runtime/src/fetch/tests/response.rs Adds a regression test to assert the redirect response type is "default".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,539 50,539 0
Ignored 1,426 1,426 0
Failed 998 998 0
Panics 2 2 0
Conformance 95.42% 95.42% 0.00%

Tested main commit: 58a24587890677d94618259dfaa5f257ab5ef9c9
Tested PR commit: 0cff1463b1ed6f50b4f0d19af17b2d5dbfd0b676
Compare commits: 58a2458...0cff146

@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.81%. Comparing base (6ddc2b4) to head (0cff146).
⚠️ Report is 913 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5212       +/-   ##
===========================================
+ Coverage   47.24%   59.81%   +12.56%     
===========================================
  Files         476      582      +106     
  Lines       46892    63460    +16568     
===========================================
+ Hits        22154    37956    +15802     
- Misses      24738    25504      +766     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Runtime Issues and PRs related to Boa's runtime features C-Tests Issues and PRs related to the tests. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Response.redirect() returns wrong type - basic instead of default

2 participants