| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 request_test; | 5 library request_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import 'package:http/src/utils.dart'; | 10 import 'package:http/src/utils.dart'; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 test('#maxRedirects', () { | 209 test('#maxRedirects', () { |
| 210 print("This test is known to be flaky, please ignore " | 210 print("This test is known to be flaky, please ignore " |
| 211 "(debug prints below added by sgjesse@)"); | 211 "(debug prints below added by sgjesse@)"); |
| 212 print("#maxRedirects test starting server..."); | 212 print("#maxRedirects test starting server..."); |
| 213 expect(startServer().then((_) { | 213 expect(startServer().then((_) { |
| 214 print("#maxRedirects test server running"); | 214 print("#maxRedirects test server running"); |
| 215 | 215 |
| 216 var request = new http.Request('POST', serverUrl.resolve('/loop?1')) | 216 var request = new http.Request('POST', serverUrl.resolve('/loop?1')) |
| 217 ..maxRedirects = 2; | 217 ..maxRedirects = 2; |
| 218 var future = request.send().catchError((e) { | 218 var future = request.send().catchError((error) { |
| 219 print("#maxRedirects test exception received"); | 219 print("#maxRedirects test exception received"); |
| 220 expect(e.error, isRedirectLimitExceededException); | 220 expect(error, isRedirectLimitExceededException); |
| 221 expect(e.error.redirects.length, equals(2)); | 221 expect(error.redirects.length, equals(2)); |
| 222 }); | 222 }); |
| 223 expect(future.catchError((_) {}).then((_) { | 223 expect(future.catchError((_) {}).then((_) { |
| 224 print("#maxRedirects test stopping server..."); | 224 print("#maxRedirects test stopping server..."); |
| 225 stopServer(); | 225 stopServer(); |
| 226 print("#maxRedirects test server stopped"); | 226 print("#maxRedirects test server stopped"); |
| 227 }), completes); | 227 }), completes); |
| 228 | 228 |
| 229 expect(future, completes); | 229 expect(future, completes); |
| 230 print("#maxRedirects test started"); | 230 print("#maxRedirects test started"); |
| 231 }), completes); | 231 }), completes); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 }); | 388 }); |
| 389 | 389 |
| 390 group('#toString()', () { | 390 group('#toString()', () { |
| 391 test('includes the method and URL', () { | 391 test('includes the method and URL', () { |
| 392 var request = new http.Request('POST', dummyUrl); | 392 var request = new http.Request('POST', dummyUrl); |
| 393 expect(request.toString(), 'POST $dummyUrl'); | 393 expect(request.toString(), 'POST $dummyUrl'); |
| 394 }); | 394 }); |
| 395 }); | 395 }); |
| 396 } | 396 } |
| 397 | 397 |
| OLD | NEW |