Skip to content

Commit e3ccd57

Browse files
authored
Consider API responses to api/ping with text/html header as failures (#2396)
* Consider API responses to api/ping with text/html header as failures See flutter/flutter#67053. * Add a TODO about reverting
1 parent 32263c0 commit e3ccd57

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎packages/devtools_app/lib/src/server_api_client.dart‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ class DevToolsServerConnection {
3535
try {
3636
// ignore: unused_local_variable
3737
final response = await http.get(uri).timeout(const Duration(seconds: 1));
38-
if (response.statusCode != 200) {
38+
if (response.statusCode != 200 ||
39+
// When running locally with `flutter run`, missing request return a 200
40+
// status with the HTML of the homepage so also consider text/html as
41+
// not valid.
42+
// TODO(dantup): Remove this check and/or change this to inspect ping's
43+
// response depending on the outcome of
44+
// https://github.com/flutter/flutter/issues/67053
45+
response.headers['content-type'] == 'text/html') {
3946
// unable to locate dev server
4047
log('devtools server not available (${response.statusCode})');
4148
return null;

0 commit comments

Comments
 (0)