| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library http_multi_server.test; | 5 library http_multi_server.test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| 11 import 'package:http_multi_server/http_multi_server.dart'; | 11 import 'package:http_multi_server/http_multi_server.dart'; |
| 12 import 'package:http_multi_server/src/utils.dart'; | 12 import 'package:http_multi_server/src/utils.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:test/test.dart'; |
| 14 | 14 |
| 15 void main() { | 15 void main() { |
| 16 group("with multiple HttpServers", () { | 16 group("with multiple HttpServers", () { |
| 17 var multiServer; | 17 var multiServer; |
| 18 var subServer1; | 18 var subServer1; |
| 19 var subServer2; | 19 var subServer2; |
| 20 var subServer3; | 20 var subServer3; |
| 21 setUp(() { | 21 setUp(() { |
| 22 return Future.wait([ | 22 return Future.wait([ |
| 23 HttpServer.bind("127.0.0.1", 0).then((server) => subServer1 = server), | 23 HttpServer.bind("127.0.0.1", 0).then((server) => subServer1 = server), |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 /// Makes a GET request to the root of [server] and returns the response. | 163 /// Makes a GET request to the root of [server] and returns the response. |
| 164 Future<http.Response> _get(HttpServer server) => http.get(_urlFor(server)); | 164 Future<http.Response> _get(HttpServer server) => http.get(_urlFor(server)); |
| 165 | 165 |
| 166 /// Makes a GET request to the root of [server] and returns the response body. | 166 /// Makes a GET request to the root of [server] and returns the response body. |
| 167 Future<String> _read(HttpServer server) => http.read(_urlFor(server)); | 167 Future<String> _read(HttpServer server) => http.read(_urlFor(server)); |
| 168 | 168 |
| 169 /// Returns the URL for the root of [server]. | 169 /// Returns the URL for the root of [server]. |
| 170 String _urlFor(HttpServer server) => | 170 String _urlFor(HttpServer server) => |
| 171 "http://${server.address.host}:${server.port}/"; | 171 "http://${server.address.host}:${server.port}/"; |
| OLD | NEW |