Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(dev-middleware): use
userAgent
query parameter as fallback …
…when header is unset (#43364) Summary: At Expo, we use [Expo Tools](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts) to connect the [built-in vscode-js-debug](https://github.com/microsoft/vscode-js-debug) to Hermes. Since there are a few differences in vscode vs chrome devtools, we need to enable a couple of modifications through the [`customMessageHandler` API](#43291). Unfortunately, vscode itself doesn't set the `user-agent` header when connecting to the inspector proxy. Becuase of that, we'd need a fallback to "manually" mark the debugger as being vscode ([we use this query parameter here](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts#L208)). This PR supports setting the `user-agent` through `?userAgent=` when the header is not set. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [ADDED] - Fallback to query parameter based `user-agent` when header is unset Pull Request resolved: #43364 Test Plan: - Install [Expo Tools](https://marketplace.visualstudio.com/items?itemName=expo.vscode-expo-tools) - Start Metro with this change. - Connect a device. - Run the vscode command `"Expo: Debug Expo app ..."` - Debugger should connect, and have it's user-agent marked as: `vscode/1.87.0 vscode-expo-tools/1.3.0` Reviewed By: huntie Differential Revision: D54804556 Pulled By: motiz88 fbshipit-source-id: 1ff558ba5350811ad042d08a713438e046759feb
- Loading branch information