Chromium Code Reviews| Index: sdk/lib/io/http.dart |
| diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart |
| index 4ce0eaed3cb99c1a98458f26b240c39fbb02129a..41c3c3ba3a5612749d83b57c3352eedd96a2662b 100644 |
| --- a/sdk/lib/io/http.dart |
| +++ b/sdk/lib/io/http.dart |
| @@ -845,52 +845,6 @@ abstract class HttpClientConnection { |
| // TODO(ajohnsen): Move these methods to the right place (request or response) |
| /** |
| - * Set this property to [:true:] if this connection should |
| - * automatically follow redirects. The default is [:true:]. |
| - * |
| - * Automatic redirect will only happen for "GET" and "HEAD" requests |
| - * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] |
| - * (301), [:HttpStatus.FOUND:] (302), |
| - * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for |
| - * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and |
| - * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For |
| - * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen |
| - * for "POST" requests with the method changed to "GET" when |
| - * following the redirect. |
| - * |
| - * All headers added to the request will be added to the redirection |
| - * request(s). However, any body send with the request will not be |
| - * part of the redirection request(s). |
| - */ |
| - bool followRedirects; |
| - |
| - /** |
| - * Set this property to the maximum number of redirects to follow |
| - * when [followRedirects] is [:true:]. If this number is exceeded the |
| - * [onError] callback will be called with a [RedirectLimitExceeded] |
| - * exception. The default value is 5. |
| - */ |
| - int maxRedirects; |
| - |
| - /** |
| - * Returns the series of redirects this connection has been through. |
| - */ |
| - List<RedirectInfo> get redirects; |
| - |
| - /** |
| - * Redirect this connection to a new URL. The default value for |
| - * [method] is the method for the current request. The default value |
| - * for [url] is the value of the [:HttpHeaders.LOCATION:] header of |
| - * the current response. All body data must have been read from the |
| - * current response before calling [redirect]. |
| - * |
| - * All headers added to the request will be added to the redirection |
| - * request(s). However, any body send with the request will not be |
| - * part of the redirection request(s). |
| - */ |
| - void redirect([String method, Uri url]); |
| - |
| - /** |
| * Detach the underlying socket from the HTTP client. When the |
| * socket is detached the HTTP client will no longer perform any |
| * operations on it. |
| @@ -955,6 +909,34 @@ abstract class HttpClientRequest |
| * Close the request for input. Returns the value of [response]. |
| */ |
| Future<HttpClientResponse> close(); |
| + |
| + /** |
| + * Set this property to the maximum number of redirects to follow |
| + * when [followRedirects] is [:true:]. If this number is exceeded the |
| + * [onError] callback will be called with a [RedirectLimitExceeded] |
| + * exception. The default value is 5. |
| + */ |
| + int maxRedirects; |
|
Søren Gjesse
2013/01/09 08:43:49
Place maxRedirects after followRedirects.
Anders Johnsen
2013/01/09 10:03:00
Done.
|
| + |
| + /** |
| + * Set this property to [:true:] if this request should |
| + * automatically follow redirects. The default is [:true:]. |
| + * |
| + * Automatic redirect will only happen for "GET" and "HEAD" requests |
| + * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] |
| + * (301), [:HttpStatus.FOUND:] (302), |
| + * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for |
| + * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and |
| + * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For |
| + * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen |
| + * for "POST" requests with the method changed to "GET" when |
| + * following the redirect. |
| + * |
| + * All headers added to the request will be added to the redirection |
| + * request(s). However, any body send with the request will not be |
| + * part of the redirection request(s). |
| + */ |
| + bool followRedirects; |
| } |
| @@ -995,6 +977,30 @@ abstract class HttpClientResponse implements Stream<List<int>> { |
| bool get isRedirect; |
| /** |
| + * Returns the series of redirects this connection has been through. |
|
Søren Gjesse
2013/01/09 08:43:49
Document that no redirects is the empty list and n
Anders Johnsen
2013/01/09 10:03:00
Done.
|
| + */ |
| + List<RedirectInfo> get redirects; |
| + |
| + /** |
| + * Redirect this connection to a new URL. The default value for |
| + * [method] is the method for the current request. The default value |
| + * for [url] is the value of the [:HttpHeaders.LOCATION:] header of |
| + * the current response. All body data must have been read from the |
| + * current response before calling [redirect]. |
| + * |
| + * All headers added to the request will be added to the redirection |
| + * request(s). However, any body send with the request will not be |
| + * part of the redirection request(s). |
| + * |
| + * If [followLoops] is set to [true], redirect will follow the redirect, |
| + * even if was already visited. Default value is [false]. |
|
Søren Gjesse
2013/01/09 08:43:49
Maybe we need to add some additional documentation
Anders Johnsen
2013/01/09 10:03:00
Done.
|
| + */ |
| + Future<HttpClientResponse> redirect([String method, |
| + Uri url, |
| + bool followLoops]); |
| + |
| + |
| + /** |
| * Returns the response headers. |
| */ |
| HttpHeaders get headers; |