feat(runtime): add Response.ok getter per Fetch Standard §7.1#5016
Merged
jedel1043 merged 1 commit intoboa-dev:mainfrom Mar 13, 2026
Merged
feat(runtime): add Response.ok getter per Fetch Standard §7.1#5016jedel1043 merged 1 commit intoboa-dev:mainfrom
jedel1043 merged 1 commit intoboa-dev:mainfrom
Conversation
- Returns true if status is 200–299, false otherwise - Aligns boa_runtime fetch with the Fetch Standard §7.1
Test262 conformance changes
Fixed tests (2):Broken tests (183):Tested main commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5016 +/- ##
===========================================
+ Coverage 47.24% 58.45% +11.20%
===========================================
Files 476 559 +83
Lines 46892 61463 +14571
===========================================
+ Hits 22154 35928 +13774
- Misses 24738 25535 +797 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
MayankRaj435
pushed a commit
to MayankRaj435/boa
that referenced
this pull request
Mar 17, 2026
…v#5016) ## Summary Adds the `Response.ok` read-only getter to `JsResponse` in `boa_runtime`, aligning with the Fetch Standard §7.1. ## Changes - **response.rs**: Added `#[boa(getter)] fn ok()` - returns `true` if status is in the range 200–299, `false` otherwise (including no status). ## Behavior ```js const res = new Response('body', { status: 200 }); console.log(res.ok); // true const err = new Response('body', { status: 404 }); console.log(err.ok); // false ``` ## Testing - [x] `cargo check -p boa_runtime` passes - [x] `cargo clippy --all-features --all-targets -- -D warnings` passes (0 warnings) - [x] `cargo fmt --all -- --check` passes - [x] `cargo test -p boa_runtime` passes (70/70) ## Spec Reference - https://fetch.spec.whatwg.org/#dom-response-ok Co-authored-by: Nakshatra Sharma <nakshatrasharma@Nakshatras-MacBook-Air.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
Response.okread-only getter toJsResponseinboa_runtime,aligning with the Fetch Standard §7.1.
Changes
#[boa(getter)] fn ok()- returnstrueifstatus is in the range 200–299,
falseotherwise (including no status).Behavior
Testing
cargo check -p boa_runtimepassescargo clippy --all-features --all-targets -- -D warningspasses (0 warnings)cargo fmt --all -- --checkpassescargo test -p boa_runtimepasses (70/70)Spec Reference