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..90b46fdc5691f7cec05a7de82e10e0a6903aa674 100644 |
| --- a/pkg/http_server/test/utils.dart |
| +++ b/pkg/http_server/test/utils.dart |
| @@ -14,7 +14,7 @@ Future<int> getStatusCode(int port, |
| bool secure: false, |
| DateTime ifModifiedSince, |
| bool rawPath: false}) { |
| - var uri; |
| + Uri uri; |
|
Siggi Cherem (dart-lang)
2014/01/06 17:40:23
note that we prefer 'var' for local variables. Was
kevmoo
2014/01/06 18:11:33
I'm a big fan of being explicit w/ the local var t
|
| if (rawPath) { |
| uri = new Uri(scheme: secure ? 'https' : 'http', |
| host: 'localhost', |
| @@ -25,6 +25,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 +39,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'); |