Skip to content

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

Open
huntie wants to merge 1 commit into
mainfrom
pr60236
Open

huntie wants to merge 1 commit into
mainfrom
pr60236

Conversation

@huntie

@huntie huntie commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

RCTInspectorNetworkReporter has no way to report a redirect. NetworkReporter::reportRequestStart already takes an optional redirect response, which it sends as Network.requestWillBeSent's redirectResponse, but the Objective-C method always passes std::nullopt. Networking stacks that report through it in place of RCTNetworking show a redirected request in the Network panel as one request, with the original URL and the final response.

Motivation

Expo is moving expo/fetch, expo-image and expo-asset onto RCTInspectorNetworkReporter, in place of its own CDP relay in Expo CLI, which reports each redirect hop. expo/fetch follows redirects in its own URLSession delegate, and reports each hop from willPerformHTTPRedirection with this method.

Changes

  • Add reportRequestStart:request:encodedDataLength:redirectResponse:, which reports a request sent after a redirect under the same request id, with the redirect response's URL, status and headers.
  • 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. Android's InspectorNetworkReporter has no equivalent yet.

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

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 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.

1 participant