Skip to content

[NetworkReporter][iOS] Support redirects in RCTInspectorNetworkReporter - #60237

Merged
cipolleschi merged 1 commit into
mainfrom
pr60236
Nov 24, 2026
Merged

cipolleschi merged 1 commit into
mainfrom
pr60236

Conversation

@huntie

@huntie huntie commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Context

Expo is moving expo/fetch, expo-image and expo-asset onto RCTInspectorNetworkReporter and InspectorNetworkReporter, in place of its own CDP relay in Expo CLI. This stack fills the gaps in those APIs for networking stacks that replace RCTNetworking and NetworkingModule.

This diff

Support reporting redirects from RCTInspectorNetworkReporter. NetworkReporter::reportRequestStart already takes an optional redirect response, sent as Network.requestWillBeSent's redirectResponse, but the Objective-C method always passes std::nullopt, so a redirected request shows in the Network panel as one request, with the original URL and the final response.

  • Add reportRequestStart:request:encodedDataLength:redirectResponse:, which reports a request sent after a redirect under the same request id. expo/fetch calls it for each hop from its URLSession delegate.
  • Implement the existing reportRequestStart:request:encodedDataLength: through it, with no redirect response.

PerformanceResourceTiming is unchanged: NetworkReporter keeps the entry from the first request, so its name and fetchStart stay those of the original request.

Changelog:
[iOS][Added] - React Native DevTools: RCTInspectorNetworkReporter method to report redirects, for networking stacks that replace RCTNetworking

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 with expo/fetch calling the new method from willPerformHTTPRedirection:

RCTInspectorNetworkReporter.reportRequestStart(requestId, request: newRequest, encodedDataLength: 0, redirectResponse: response)
  • ✅ On an iPhone simulator (iOS 27.2), with the Network domain enabled over CDP, an expo/fetch request to https://httpbin.org/redirect/2 produced, under one request id:
requestWillBeSent  https://httpbin.org/redirect/2
requestWillBeSent  https://httpbin.org/relative-redirect/1  redirectResponse: 302 https://httpbin.org/redirect/2, Location: /relative-redirect/1
requestWillBeSent  https://httpbin.org/get                  redirectResponse: 302 https://httpbin.org/relative-redirect/1, Location: /get
responseReceived   200 https://httpbin.org/get
loadingFinished
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 23, 2026
@facebook-github-tools facebook-github-tools Bot added p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Nov 23, 2026
@huntie
huntie added this pull request to stack #60262 November 24, 2026 12:57
@cipolleschi
cipolleschi enabled stacked auto-merge (squash) November 24, 2026 16:10
@cipolleschi
cipolleschi merged commit e7ee65e into main Nov 24, 2026
57 checks passed
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 Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants