Skip to content

Commit

Permalink
fix: add userAgent query parameter in debugger (#237)
Browse files Browse the repository at this point in the history
* fix: add `userAgent` query parameter in debugger

* docs: fix typo in comment
  • Loading branch information
byCedric authored Mar 6, 2024
1 parent 3fba51a commit 7c978e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/expoDebuggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import {
import { ExpoProjectCache, ExpoProject, findProjectFromWorkspaces } from './expo/project';
import { debug } from './utils/debug';
import { featureTelemetry } from './utils/telemetry';
import { version as extensionVersion } from '../package.json';

const log = debug.extend('expo-debuggers');

const DEBUG_TYPE = 'expo';
const DEBUG_COMMAND = 'expo.debug.start';
const DEBUG_USER_AGENT = `vscode/${vscode.version} vscode-expo-tools/${extensionVersion}`;

interface ExpoDebugConfig extends vscode.DebugConfiguration {
projectRoot: string;
Expand Down Expand Up @@ -198,7 +200,10 @@ async function resolveDeviceConfig(config: ExpoDebugConfig, project: ExpoProject
workflow: device._workflow,

// The address of the device to connect to
websocketAddress: `${device.webSocketDebuggerUrl}&type=vscode`,
websocketAddress:
device.webSocketDebuggerUrl +
'&type=vscode' + // Adding the "classic" `type=vscode` query parameter (SDK <=49)
`&userAgent=${encodeURIComponent(DEBUG_USER_AGENT)}`, // Adding the modern "userAgent" query parameter (SDK >=50)

// Define the required root paths to resolve source maps
localRoot: project.root,
Expand Down

0 comments on commit 7c978e5

Please sign in to comment.