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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 * be used. | 960 * be used. |
961 * | 961 * |
962 * HttpClientRequest request = ... | 962 * HttpClientRequest request = ... |
963 * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); | 963 * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); |
964 * request.write(...); // Strings written will be ISO-8859-1 encoded. | 964 * request.write(...); // Strings written will be ISO-8859-1 encoded. |
965 * | 965 * |
966 * If an unsupported encoding is used an exception will be thrown if | 966 * If an unsupported encoding is used an exception will be thrown if |
967 * using one of the write methods taking a string. | 967 * using one of the write methods taking a string. |
968 */ | 968 */ |
969 abstract class HttpClientRequest | 969 abstract class HttpClientRequest |
970 implements IOSink<HttpClientRequest> { | 970 implements IOSink<HttpClientResponse> { |
971 /** | 971 /** |
972 * Gets and sets the content length of the request. If the size of | 972 * Gets and sets the content length of the request. If the size of |
973 * the request is not known in advance set content length to -1, | 973 * the request is not known in advance set content length to -1, |
974 * which is also the default. | 974 * which is also the default. |
975 */ | 975 */ |
976 int contentLength; | 976 int contentLength; |
977 | 977 |
978 /** | 978 /** |
979 * Returns the request headers. | 979 * Returns the request headers. |
980 */ | 980 */ |
981 HttpHeaders get headers; | 981 HttpHeaders get headers; |
982 | 982 |
983 /** | 983 /** |
984 * Cookies to present to the server (in the 'cookie' header). | 984 * Cookies to present to the server (in the 'cookie' header). |
985 */ | 985 */ |
986 List<Cookie> get cookies; | 986 List<Cookie> get cookies; |
987 | 987 |
988 /** | 988 /** |
989 * Gets and sets the requested persistent connection state. | 989 * Gets and sets the requested persistent connection state. |
990 * The default value is [:true:]. | 990 * The default value is [:true:]. |
991 */ | 991 */ |
992 bool persistentConnection; | 992 bool persistentConnection; |
993 | 993 |
994 /** | 994 /** |
995 * A [HttpClientResponse] future that will complete once the response is | 995 * A [HttpClientResponse] future that will complete once the response is |
996 * available. If an error occurs before the response is available, this | 996 * available. If an error occurs before the response is available, this |
997 * future will complete with an error. | 997 * future will complete with an error. |
998 */ | 998 */ |
999 Future<HttpClientResponse> get response; | 999 Future<HttpClientResponse> get done; |
1000 | 1000 |
1001 /** | 1001 /** |
1002 * Close the request for input. Returns the value of [response]. | 1002 * Close the request for input. Returns the value of [done]. |
1003 */ | 1003 */ |
1004 Future<HttpClientResponse> close(); | 1004 Future<HttpClientResponse> close(); |
1005 | 1005 |
1006 /** | 1006 /** |
1007 * Set this property to [:true:] if this request should | 1007 * Set this property to [:true:] if this request should |
1008 * automatically follow redirects. The default is [:true:]. | 1008 * automatically follow redirects. The default is [:true:]. |
1009 * | 1009 * |
1010 * Automatic redirect will only happen for "GET" and "HEAD" requests | 1010 * Automatic redirect will only happen for "GET" and "HEAD" requests |
1011 * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] | 1011 * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] |
1012 * (301), [:HttpStatus.FOUND:] (302), | 1012 * (301), [:HttpStatus.FOUND:] (302), |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 class RedirectLimitExceededException extends RedirectException { | 1219 class RedirectLimitExceededException extends RedirectException { |
1220 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1220 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
1221 : super("Redirect limit exceeded", redirects); | 1221 : super("Redirect limit exceeded", redirects); |
1222 } | 1222 } |
1223 | 1223 |
1224 | 1224 |
1225 class RedirectLoopException extends RedirectException { | 1225 class RedirectLoopException extends RedirectException { |
1226 const RedirectLoopException(List<RedirectInfo> redirects) | 1226 const RedirectLoopException(List<RedirectInfo> redirects) |
1227 : super("Redirect loop detected", redirects); | 1227 : super("Redirect loop detected", redirects); |
1228 } | 1228 } |
OLD | NEW |