Chromium Code Reviews| Index: pkg/http_server/test/utils.dart |
| diff --git a/pkg/http_server/test/utils.dart b/pkg/http_server/test/utils.dart |
| index 5d3b56a4f6837e883d1b089129ade69df04ca1ef..ad2f9854777c2a33d3884cd9fd81d9e49df2a0c2 100644 |
| --- a/pkg/http_server/test/utils.dart |
| +++ b/pkg/http_server/test/utils.dart |
| @@ -8,13 +8,10 @@ import 'dart:async'; |
| import 'dart:convert'; |
| import 'dart:io'; |
| -Future<int> getStatusCode(int port, |
| - String path, |
| - {String host, |
| - bool secure: false, |
| - DateTime ifModifiedSince, |
| - bool rawPath: false}) { |
| - var uri; |
| +Future<int> getStatusCode(int port, String path, {String host, |
|
Anders Johnsen
2014/01/05 19:36:08
Please don't change this, this is not the style us
|
| + bool secure: false, DateTime ifModifiedSince, bool rawPath: false}) { |
| + |
| + Uri uri; |
| if (rawPath) { |
| uri = new Uri(scheme: secure ? 'https' : 'http', |
| host: 'localhost', |
| @@ -25,6 +22,7 @@ Future<int> getStatusCode(int port, |
| new Uri.https('localhost:$port', path) : |
| new Uri.http('localhost:$port', path)); |
| } |
| + |
| return new HttpClient().getUrl(uri) |
| .then((request) { |
| if (host != null) request.headers.host = host; |
| @@ -38,25 +36,26 @@ Future<int> getStatusCode(int port, |
| } |
| -Future<HttpHeaders> getHeaders(int port, String path) { |
| - return new HttpClient().get('localhost', port, path) |
| +Future<HttpHeaders> getHeaders(int port, String path) => |
| + new HttpClient() |
| + .get('localhost', port, path) |
| .then((request) => request.close()) |
| .then((response) => response.drain().then( |
| (_) => response.headers)); |
| -} |
| -Future<String> getAsString(int port, String path) { |
| - return new HttpClient().get('localhost', port, path) |
| + |
| +Future<String> getAsString(int port, String path) => |
| + new HttpClient() |
| + .get('localhost', port, path) |
| .then((request) => request.close()) |
| .then((response) => UTF8.decodeStream(response)); |
| -} |
| const CERTIFICATE = "localhost_cert"; |
| -setupSecure() { |
| +void setupSecure() { |
| String certificateDatabase = Platform.script.resolve('pkcert').toFilePath(); |
| SecureSocket.initialize(database: certificateDatabase, |
| password: 'dartdart'); |