Chromium Code Reviews| Index: pkg/http/test/request_test.dart |
| diff --git a/pkg/http/test/request_test.dart b/pkg/http/test/request_test.dart |
| index 5c2d98c15e5403bb5bd5fbfb720be10717cde618..a9bd8d6d2a2ebda5c402425314737c6ed40cd747 100644 |
| --- a/pkg/http/test/request_test.dart |
| +++ b/pkg/http/test/request_test.dart |
| @@ -191,6 +191,53 @@ void main() { |
| // when issue 6284 is fixed. |
| }); |
| + test('#followRedirects', () { |
| + print("This test is known to be flaky, please ignore " |
| + "(debug prints below added by sgjesse@)"); |
| + print("#followRedirects test starting server..."); |
| + startServer(); |
| + print("#followRedirects test server running"); |
| + |
| + var request = new http.Request('POST', serverUrl.resolve('/redirect')) |
| + ..followRedirects = false; |
|
Bob Nystrom
2012/11/28 01:50:18
How about not using a cascade here. Or, if you mus
|
| + var future = request.send().transform((response) { |
| + print("#followRedirects test response received"); |
| + expect(response.statusCode, equals(302)); |
| + }); |
| + future.onComplete((_) { |
| + print("#followRedirects test stopping server..."); |
| + stopServer(); |
| + print("#followRedirects test server stopped"); |
| + }); |
| + |
| + expect(future, completes); |
| + print("#followRedirects test started"); |
| + }); |
| + |
| + test('#maxRedirects', () { |
| + print("This test is known to be flaky, please ignore " |
| + "(debug prints below added by sgjesse@)"); |
| + print("#maxRedirects test starting server..."); |
| + startServer(); |
| + print("#maxRedirects test server running"); |
| + |
| + var request = new http.Request('POST', serverUrl.resolve('/loop?1')) |
| + ..maxRedirects = 2; |
| + var future = request.send().transformException((e) { |
| + print("#maxRedirects test exception received"); |
| + expect(e, isRedirectLimitExceededException); |
| + expect(e.redirects.length, equals(2)); |
| + }); |
| + future.onComplete((_) { |
| + print("#maxRedirects test stopping server..."); |
| + stopServer(); |
| + print("#maxRedirects test server stopped"); |
| + }); |
| + |
| + expect(future, completes); |
| + print("#maxRedirects test started"); |
| + }); |
| + |
| group('content-type header', () { |
| test('defaults to empty', () { |
| var request = new http.Request('POST', dummyUrl); |