Skip to content

feat: add injectable _fetch for React Native compatibility#79

Merged
bobbyg603 merged 2 commits into
masterfrom
feat/injectable-fetch
Apr 18, 2026
Merged

feat: add injectable _fetch for React Native compatibility#79
bobbyg603 merged 2 commits into
masterfrom
feat/injectable-fetch

Conversation

@bobbyg603
Copy link
Copy Markdown
Member

Summary

  • Adds a private _fetch property (same pattern as existing _formData) defaulting to globalThis.fetch
  • post() and postFeedback() now use this._fetch instead of globalThis.fetch
  • Allows callers like @bugsplat/expo to inject expo/fetch, which properly serializes JS Blob objects in FormData — React Native's built-in globalThis.fetch silently drops them

Test plan

  • All existing tests pass
  • New test verifies the injectable _fetch is called instead of globalThis.fetch
  • Verified end-to-end on iOS: injecting expo/fetch makes componentStack.txt Blob attachments appear in BugSplat reports

🤖 Generated with Claude Code

React Native's globalThis.fetch silently drops JS Blob objects from
FormData. This allows callers (e.g. bugsplat-expo) to inject expo/fetch
which properly serializes Blob attachments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 18, 2026 17:26
Copy link
Copy Markdown

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 introduces an injectable fetch implementation to the BugSplat client to improve React Native compatibility (notably enabling expo/fetch to correctly upload Blob parts in FormData).

Changes:

  • Added a private _fetch function on BugSplat, defaulting to globalThis.fetch.
  • Updated post() and postFeedback() to call this._fetch instead of globalThis.fetch.
  • Updated/added tests to mock and validate usage of the injectable fetch.

Reviewed changes

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

File Description
src/bugsplat.ts Adds _fetch and routes crash/feedback POSTs through it for injectable networking.
spec/bugsplat.spec.ts Switches tests to inject a mocked _fetch and adds a targeted test for fetch injection behavior.

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

Comment thread src/bugsplat.ts
Comment thread spec/bugsplat.spec.ts
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bobbyg603 bobbyg603 merged commit 9413c37 into master Apr 18, 2026
7 checks passed
@bobbyg603 bobbyg603 deleted the feat/injectable-fetch branch April 18, 2026 18:04
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.

3 participants