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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * HTTP status codes. | 8 * HTTP status codes. |
9 */ | 9 */ |
10 abstract class HttpStatus { | 10 abstract class HttpStatus { |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 * | 837 * |
838 * The second future, which is returned by [:close:], completes with | 838 * The second future, which is returned by [:close:], completes with |
839 * an [HttpClientResponse] object when the response is received from | 839 * an [HttpClientResponse] object when the response is received from |
840 * the server. This object contains the headers and body of the | 840 * the server. This object contains the headers and body of the |
841 * response. | 841 * response. |
842 | 842 |
843 * The future for [HttpClientRequest] is created by methods such as | 843 * The future for [HttpClientRequest] is created by methods such as |
844 * [getUrl] and [open]. | 844 * [getUrl] and [open]. |
845 * | 845 * |
846 * When the HTTP response is ready a [HttpClientResponse] object is | 846 * When the HTTP response is ready a [HttpClientResponse] object is |
847 * provided which provides access to the headers and body of the response. | 847 * provided which provides access to the headers and body of the response. The |
| 848 * body is available as a stream implemented by [HttpClientResponse]. |
| 849 * If a body is present, it must be read. Otherwise, it'll lead to a resource |
| 850 * leaks. Consider using [HttpClientResponse.drain] if the body is unused. |
848 * | 851 * |
849 * HttpClient client = new HttpClient(); | 852 * HttpClient client = new HttpClient(); |
850 * client.getUrl(Uri.parse("http://www.example.com/")) | 853 * client.getUrl(Uri.parse("http://www.example.com/")) |
851 * .then((HttpClientRequest request) { | 854 * .then((HttpClientRequest request) { |
852 * // Prepare the request then call close on it to send it. | 855 * // Prepare the request then call close on it to send it. |
853 * return request.close(); | 856 * return request.close(); |
854 * }) | 857 * }) |
855 * .then((HttpClientResponse response) { | 858 * .then((HttpClientResponse response) { |
856 * // Process the response. | 859 * // Process the response. |
857 * }); | 860 * }); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 | 1388 |
1386 class RedirectException implements HttpException { | 1389 class RedirectException implements HttpException { |
1387 final String message; | 1390 final String message; |
1388 final List<RedirectInfo> redirects; | 1391 final List<RedirectInfo> redirects; |
1389 | 1392 |
1390 const RedirectException(String this.message, | 1393 const RedirectException(String this.message, |
1391 List<RedirectInfo> this.redirects); | 1394 List<RedirectInfo> this.redirects); |
1392 | 1395 |
1393 String toString() => "RedirectException: $message"; | 1396 String toString() => "RedirectException: $message"; |
1394 } | 1397 } |
OLD | NEW |