@@ -67,9 +67,9 @@ private static void UseVisualStudioDebuggerConnectionRequestHandlers(this IAppli
67
67
if ( requestPath . StartsWithSegments ( "/json" )
68
68
&& ! request . Headers . ContainsKey ( "User-Agent" ) )
69
69
{
70
+ var debuggerHost = "http://localhost:9222" ;
70
71
if ( requestPath . Equals ( "/json" , StringComparison . OrdinalIgnoreCase ) || requestPath . Equals ( "/json/list" , StringComparison . OrdinalIgnoreCase ) )
71
72
{
72
- var debuggerHost = "http://localhost:9222" ;
73
73
var availableTabs = await GetOpenedBrowserTabs ( debuggerHost ) ;
74
74
75
75
// Filter the list to only include tabs displaying the requested app,
@@ -101,15 +101,10 @@ private static void UseVisualStudioDebuggerConnectionRequestHandlers(this IAppli
101
101
}
102
102
else if ( requestPath . Equals ( "/json/version" , StringComparison . OrdinalIgnoreCase ) )
103
103
{
104
+ var browserVersionJson = await GetBrowserVersionInfoAsync ( debuggerHost ) ;
105
+
104
106
context . Response . ContentType = "application/json" ;
105
- await context . Response . WriteAsync ( JsonSerializer . Serialize ( new Dictionary < string , string >
106
- {
107
- { "Browser" , "Chrome/71.0.3578.98" } ,
108
- { "Protocol-Version" , "1.3" } ,
109
- { "User-Agent" , "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" } ,
110
- { "V8-Version" , "7.1.302.31" } ,
111
- { "WebKit-Version" , "537.36 (@15234034d19b85dcd9a03b164ae89d04145d8368)" } ,
112
- } ) ) ;
107
+ await context . Response . WriteAsync ( browserVersionJson ) ;
113
108
}
114
109
}
115
110
else
@@ -263,6 +258,12 @@ private static string GetLaunchEdgeInstructions(string appRootUrl)
263
258
}
264
259
}
265
260
261
+ private static async Task < string > GetBrowserVersionInfoAsync ( string debuggerHost )
262
+ {
263
+ using var httpClient = new HttpClient { Timeout = TimeSpan . FromSeconds ( 5 ) } ;
264
+ return await httpClient . GetStringAsync ( $ "{ debuggerHost } /json/version") ;
265
+ }
266
+
266
267
private static async Task < IEnumerable < BrowserTab > > GetOpenedBrowserTabs ( string debuggerHost )
267
268
{
268
269
using var httpClient = new HttpClient { Timeout = TimeSpan . FromSeconds ( 5 ) } ;
0 commit comments