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

Unified Diff: sdk/lib/io/http.dart

Issue 21411003: Add redirect method to HttpResponse (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months 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 | « no previous file | sdk/lib/io/http_impl.dart » ('j') | sdk/lib/io/http_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 755c96ccf7d04b1e3f46fe4bffd1b3c0184fce6a..f5ee40df9b4e108cfd5e58426a2282eb50960242 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -845,6 +845,27 @@ abstract class HttpResponse implements IOSink {
List<Cookie> get cookies;
/**
+ * Send a redirect to [location] to the client.
Anders Johnsen 2013/08/02 08:22:03 "to the client." may be redundant.
Søren Gjesse 2013/08/02 09:01:06 Done.
+ *
+ * The [location] argument can be either a [Uri] or a [String]. If
+ * it is a [String] it is turned into a [Uri] using [Uri.parse].
+ *
+ * The redirect response will always have an absolute URI in the
+ * `Location` header. If the URI passed in [location] is relative it
+ * will be turned into an absolute URI by resolving it against the
+ * URI of the current request and the address and port of the
+ * server.
+ *
+ * By default the HTTP status code `302` is used for the redirect,
+ * but an alternative one can be specified using the [status]
+ * argument.
+ *
+ * This method will also call `close`, and the returned future is
+ * the furure returned by `close`.
+ */
+ Future redirect(location, [int status = HttpStatus.MOVED_TEMPORARILY]);
Anders Johnsen 2013/08/02 08:22:03 I think it should be a named argument.
Søren Gjesse 2013/08/02 09:01:06 Done.
+
+ /**
* Detaches the underlying socket from the HTTP server. When the
* socket is detached the HTTP server will no longer perform any
* operations on it.
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | sdk/lib/io/http_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698