Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: pkg/http/test/request_test.dart

Issue 11414195: Make #maxRedirects and #followRedirects work for the dart:io HTTP client. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/lib/src/io_client.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/http/lib/src/io_client.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698