| Index: tests/standalone/io/http_client_request_test.dart
|
| diff --git a/tests/standalone/io/http_client_request_test.dart b/tests/standalone/io/http_client_request_test.dart
|
| index cd2a7beb045adca865c1232f7cea83fe1780d193..dae2b2aae6eed0a3bec7476d18bef8a00be6e68d 100644
|
| --- a/tests/standalone/io/http_client_request_test.dart
|
| +++ b/tests/standalone/io/http_client_request_test.dart
|
| @@ -9,30 +9,27 @@ import "dart:typed_data";
|
| import "package:async_helper/async_helper.dart";
|
| import "package:expect/expect.dart";
|
|
|
| -
|
| void testClientRequest(Future handler(request)) {
|
| HttpServer.bind("127.0.0.1", 0).then((server) {
|
| server.listen((request) {
|
| - request.drain()
|
| - .then((_) => request.response.close())
|
| - .catchError((_) {});
|
| + request.drain().then((_) => request.response.close()).catchError((_) {});
|
| });
|
|
|
| var client = new HttpClient();
|
| - client.get("127.0.0.1", server.port, "/")
|
| - .then((request) {
|
| - return handler(request);
|
| - })
|
| - .then((response) => response.drain())
|
| - .catchError((_) {})
|
| - .whenComplete(() {
|
| - client.close();
|
| - server.close();
|
| - });
|
| + client
|
| + .get("127.0.0.1", server.port, "/")
|
| + .then((request) {
|
| + return handler(request);
|
| + })
|
| + .then((response) => response.drain())
|
| + .catchError((_) {})
|
| + .whenComplete(() {
|
| + client.close();
|
| + server.close();
|
| + });
|
| });
|
| }
|
|
|
| -
|
| void testResponseDone() {
|
| testClientRequest((request) {
|
| request.close().then((res1) {
|
| @@ -44,7 +41,6 @@ void testResponseDone() {
|
| });
|
| }
|
|
|
| -
|
| void testBadResponseAdd() {
|
| asyncStart();
|
| testClientRequest((request) {
|
| @@ -83,7 +79,6 @@ void testBadResponseAdd() {
|
| });
|
| }
|
|
|
| -
|
| void testBadResponseClose() {
|
| asyncStart();
|
| testClientRequest((request) {
|
| @@ -107,7 +102,6 @@ void testBadResponseClose() {
|
| });
|
| }
|
|
|
| -
|
| void main() {
|
| testResponseDone();
|
| testBadResponseAdd();
|
|
|