Skip to content

feat(fetch): make Body subclassable#55

Merged
medz merged 2 commits into
mainfrom
feat/body-subclassable
Jun 23, 2026
Merged

feat(fetch): make Body subclassable#55
medz merged 2 commits into
mainfrom
feat/body-subclassable

Conversation

@medz

@medz medz commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Type

Feature

Summary

  • Replace the Body factory with a public generative constructor so downstream wrappers can call super(init).
  • Move existing BodyInit normalization into an internal state builder so Body and subclasses share the same construction behavior.
  • Preserve clone semantics for stream-backed bodies while allowing subclasses to override clone() and return their own type.
  • Add public API coverage for a Body subclass that keeps wrapper metadata and clones stream bodies.

Impact

External packages can now extend Body directly without reimplementing body normalization or wrapping the Fetch body primitive.

Validation

  • dart format --output=none --set-exit-if-changed .
  • dart analyze
  • dart test -p vm -p node -p chrome

Closes #52

@medz medz added the enhancement New feature or request label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@medz, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 12 minutes and 5 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 81a65e0d-37fb-46d5-991f-01a1e78099b5

📥 Commits

Reviewing files that changed from the base of the PR and between 3495187 and 2a37e91.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • lib/src/fetch/body.dart
  • lib/src/fetch/request.native.dart
  • lib/src/fetch/response.native.dart
  • test/public_api_surface_test.dart
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/body-subclassable

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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93e7fbb1ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/src/fetch/body.dart
@medz medz force-pushed the feat/body-subclassable branch from 4fcb74f to 2a37e91 Compare June 23, 2026 09:24
@medz medz merged commit 9db0b0c into main Jun 23, 2026
2 checks passed
@medz medz deleted the feat/body-subclassable branch June 23, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(fetch): make Body subclassable by downstream wrappers

1 participant