Skip to content

Commit cf37e9a

Browse files
committed
fix: Use HttpClient for Chrome detection instead of Future.get
- Fixed compilation error in _checkForExistingChrome function - Use dart:io HttpClient instead of non-existent Future.get - This properly checks for existing Chrome instances on the specified port
1 parent 2edeb06 commit cf37e9a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/src/cli/serve.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,10 +1427,11 @@ Future<Map<String, dynamic>> _handleQrLoginWaitServe(
14271427
/// Check if Chrome is already running on the specified port
14281428
Future<bool> _checkForExistingChrome(int port) async {
14291429
try {
1430-
final response = await Future.get(
1431-
'http://127.0.0.1:$port/json',
1432-
headers: {'Accept': 'application/json'},
1433-
).timeout(Duration(milliseconds: 500));
1430+
final uri = Uri.parse('http://127.0.0.1:$port/json');
1431+
final client = HttpClient();
1432+
final request = await client.getUrl(uri);
1433+
request.headers.set('Accept', 'application/json');
1434+
final response = await request.close();
14341435
return response.statusCode == 200;
14351436
} catch (e) {
14361437
return false;

0 commit comments

Comments
 (0)