Skip to content

Add text variant of maybeStoreResponseBody to RCTInspectorNetworkReporter - #60188

Draft
huntie wants to merge 1 commit into
mainfrom
pr60188
Draft

huntie wants to merge 1 commit into
mainfrom
pr60188

Conversation

@huntie

@huntie huntie commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

RCTInspectorNetworkReporter is the integration point for networking stacks that replace RCTNetworking, but it has no typed way to store a complete text response preview. maybeStoreResponseBody:data:base64Encoded: declares NSData, though its implementation also accepts an NSString, so Swift callers cannot reach that branch.

Motivation

Expo is moving expo/fetch, expo-image and expo-asset onto RCTInspectorNetworkReporter, in place of its own CDP relay in Expo CLI. Its reporter is written in Swift and holds each response body in full once loading finishes, so for text it needs to store a decoded string. It currently routes through a small Objective-C helper that passes the string as id (expo/expo#53160). maybeStoreResponseBodyIncremental accepts a string, but it is built for chunked delivery, keeping a second copy in a process-wide buffer until reportResponseEnd.

Changes

  • Add maybeStoreResponseBody:body:, which stores a decoded text body, and is a no-op when CDP debugging is disabled.
  • Leave maybeStoreResponseBody:data:base64Encoded: unchanged, since RCTNetworking relies on its NSString branch for base64 strings.

Changelog:
[iOS][Added] - React Native DevTools: RCTInspectorNetworkReporter maybeStoreResponseBody:body: method, to store text response previews from Swift

Test Plan

Built Expo's bare-expo app from source against React Native 0.89.0-rc.2, whose copy of these files is identical to main, with this change applied and Expo's Swift reporter calling the new method in place of its Objective-C helper:

RCTInspectorNetworkReporter.maybeStoreResponseBody(requestId, body: text)
  • ✅ Builds, with Swift resolving maybeStoreResponseBody(_:body:).
  • ✅ On an iPhone simulator (iOS 27.2), with the Network domain enabled over CDP, an expo/fetch request for a JSON response returned its full body from Network.getResponseBody, as text (base64Encoded: false).
yarn cxx-api-build

ℹ️ Adds the method to the four ReactApple snapshots. The ReactAndroid views failed locally on an unrelated Doxygen parse error in fmt's headers.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 20, 2026
@huntie
huntie added this pull request to stack #60189 November 20, 2026 17:36
@huntie
huntie removed this pull request from stack #60189 November 20, 2026 18:17
@huntie
huntie changed the base branch from pr60187 to main November 20, 2026 18:17

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant