Chromium Code Reviews| Index: runtime/bin/vmservice/client/lib/service_html.dart |
| diff --git a/runtime/bin/vmservice/client/lib/service_html.dart b/runtime/bin/vmservice/client/lib/service_html.dart |
| index bd611a55e666700ea0433804f6863a00e3fae4f5..ab63b99751320b8732ec94f8254438fff636b507 100644 |
| --- a/runtime/bin/vmservice/client/lib/service_html.dart |
| +++ b/runtime/bin/vmservice/client/lib/service_html.dart |
| @@ -32,19 +32,28 @@ class HttpVM extends VM { |
| } |
| Future<String> getString(String id) { |
| + // Ensure we don't request host//id. |
| + if (host.endsWith('/') && id.startsWith('/')) { |
| + id = id.substring(1); |
| + } |
| Logger.root.info('Fetching $id from $host'); |
| - return HttpRequest.getString(host + id).catchError((error) { |
| + return HttpRequest.request(host + id, |
| + requestHeaders: { |
| + 'observatory': 'observatory' |
|
turnidge
2014/06/04 18:02:24
Header names are usually Dashed-With-Capital-Lette
Cutch
2014/06/04 20:28:57
Done.
|
| + }).then((HttpRequest request) { |
| + return request.responseText; |
| + }).catchError((error) { |
| // If we get an error here, the network request has failed. |
| - Logger.root.severe('HttpRequest.getString failed.'); |
| + Logger.root.severe('HttpRequest.request failed.'); |
| var request = error.target; |
| return JSON.encode({ |
| 'type': 'ServiceException', |
| 'id': '', |
| - 'response': error.target.responseText, |
| + 'response': request.responseText, |
| 'kind': 'NetworkException', |
| - 'message': 'Could not connect to service. Check that you started the' |
| - ' VM with the following flags:\n --enable-vm-service' |
| - ' --pause-isolates-on-exit' |
| + 'message': 'Could not connect to service (${request.statusText}). ' |
| + 'Check that you started the VM with the following flags: ' |
| + '--observe' |
| }); |
| }); |
| } |