Skip to content

[NetworkReporter][Android] Support redirects in InspectorNetworkReporter - #60239

Open
huntie wants to merge 1 commit into
mainfrom
pr60239
Open

huntie wants to merge 1 commit into
mainfrom
pr60239

Conversation

@huntie

@huntie huntie commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

InspectorNetworkReporter 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 JNI binding always passes std::nullopt. Networking stacks that report through it in place of NetworkingModule show a redirected request in the Network panel as one request, with the original URL and the final response.

This is the Android counterpart to #60237.

Motivation

Expo is moving expo/fetch, expo-image and expo-asset onto InspectorNetworkReporter, in place of its own CDP relay in Expo CLI, which reports each redirect hop. An OkHttp network interceptor sees each hop, and reports it with this method.

Changes

  • Add a reportRequestStart overload taking the redirect response's URL, status and headers, which reports a request sent after a redirect under the same request id.
  • Share the request conversion between the two JNI methods.

Changelog:
[Android][Added] - React Native DevTools: InspectorNetworkReporter.reportRequestStart overload to report redirects, for networking stacks that replace NetworkingModule

Test Plan

  • ✅ ./gradlew :packages:react-native:ReactAndroid:compileDebugKotlin, and javap -s shows the overload's JVM descriptor, which matches the one fbjni derives from the new JNI method's signature:
(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;JLjava/lang/String;ILjava/util/Map;)V
  • ✅ Compiled JInspectorNetworkReporter.cpp for arm64-v8a with the NDK, with and without REACT_NATIVE_DEBUGGER_ENABLED.
  • ℹ️ Added the JNI method to the four ReactAndroid C++ API snapshots by hand; yarn cxx-api-build fails locally for the Android views on an unrelated Doxygen parse error in fmt's headers.
  • Not run on a device: the overload has no caller in React Native itself.

@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