mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
Clean up HttpClient docs
In particular, fix typos, and update many comments to begin with a one-sentence summary, for better readability at api.dartlang.org. Fixes #31608, #29460, #31538, #31449, #31505 Bug: https://github.com/dart-lang/sdk/issues/31608 Bug: https://github.com/dart-lang/sdk/issues/29460 Bug: https://github.com/dart-lang/sdk/issues/31538 Bug: https://github.com/dart-lang/sdk/issues/31449 Bug: https://github.com/dart-lang/sdk/issues/31505 Change-Id: If00726ef3636479f0613c91e48ff9f0e24b12502 Reviewed-on: https://dart-review.googlesource.com/30120 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Zach Anderson <zra@google.com>
This commit is contained in:
parent
3bc3ab979e
commit
eaa6790ef2
1 changed files with 43 additions and 48 deletions
|
@ -182,7 +182,7 @@ abstract class HttpStatus {
|
|||
*/
|
||||
abstract class HttpServer implements Stream<HttpRequest> {
|
||||
/**
|
||||
* Get and set the default value of the `Server` header for all responses
|
||||
* Gets and sets the default value of the `Server` header for all responses
|
||||
* generated by this [HttpServer].
|
||||
*
|
||||
* If [serverHeader] is `null`, no `Server` header will be added to each
|
||||
|
@ -220,8 +220,8 @@ abstract class HttpServer implements Stream<HttpRequest> {
|
|||
bool autoCompress;
|
||||
|
||||
/**
|
||||
* Get or set the timeout used for idle keep-alive connections. If no further
|
||||
* request is seen within [idleTimeout] after the previous request was
|
||||
* Gets or sets the timeout used for idle keep-alive connections. If no
|
||||
* further request is seen within [idleTimeout] after the previous request was
|
||||
* completed, the connection is dropped.
|
||||
*
|
||||
* Default is 120 seconds.
|
||||
|
@ -721,7 +721,7 @@ abstract class HeaderValue {
|
|||
/**
|
||||
* Gets the map of parameters.
|
||||
*
|
||||
* This map cannot be modified. invoking any operation which would
|
||||
* This map cannot be modified. Invoking any operation which would
|
||||
* modify the map will throw [UnsupportedError].
|
||||
*/
|
||||
Map<String, String> get parameters;
|
||||
|
@ -1158,7 +1158,7 @@ abstract class HttpResponse implements IOSink {
|
|||
Duration deadline;
|
||||
|
||||
/**
|
||||
* Get or set if the [HttpResponse] should buffer output.
|
||||
* Gets or sets if the [HttpResponse] should buffer output.
|
||||
*
|
||||
* Default value is `true`.
|
||||
*
|
||||
|
@ -1308,14 +1308,14 @@ abstract class HttpClient {
|
|||
static const int DEFAULT_HTTP_PORT = 80;
|
||||
static const int DEFAULT_HTTPS_PORT = 443;
|
||||
|
||||
/**
|
||||
* Get and set the idle timeout of non-active persistent (keep-alive)
|
||||
* connections. The default value is 15 seconds.
|
||||
*/
|
||||
/// Gets and sets the idle timeout of non-active persistent (keep-alive)
|
||||
/// connections.
|
||||
///
|
||||
/// The default value is 15 seconds.
|
||||
Duration idleTimeout;
|
||||
|
||||
/**
|
||||
* Get and set the maximum number of live connections, to a single host.
|
||||
* Gets and sets the maximum number of live connections, to a single host.
|
||||
*
|
||||
* Increasing this number may lower performance and take up unwanted
|
||||
* system resources.
|
||||
|
@ -1327,7 +1327,7 @@ abstract class HttpClient {
|
|||
int maxConnectionsPerHost;
|
||||
|
||||
/**
|
||||
* Get and set whether the body of a response will be automatically
|
||||
* Gets and sets whether the body of a response will be automatically
|
||||
* uncompressed.
|
||||
*
|
||||
* The body of an HTTP response can be compressed. In most
|
||||
|
@ -1336,7 +1336,7 @@ abstract class HttpClient {
|
|||
* body. However in some situations (e.g. implementing a transparent
|
||||
* proxy) keeping the uncompressed stream is required.
|
||||
*
|
||||
* NOTE: Headers in from the response is never modified. This means
|
||||
* NOTE: Headers in the response are never modified. This means
|
||||
* that when automatic un-compression is turned on the value of the
|
||||
* header `Content-Length` will reflect the length of the original
|
||||
* compressed body. Likewise the header `Content-Encoding` will also
|
||||
|
@ -1354,14 +1354,13 @@ abstract class HttpClient {
|
|||
*/
|
||||
bool autoUncompress;
|
||||
|
||||
/**
|
||||
* Set and get the default value of the `User-Agent` header for all requests
|
||||
* generated by this [HttpClient]. The default value is
|
||||
* `Dart/<version> (dart:io)`.
|
||||
*
|
||||
* If the userAgent is set to `null`, no default `User-Agent` header will be
|
||||
* added to each request.
|
||||
*/
|
||||
/// Gets and sets the default value of the `User-Agent` header for all requests
|
||||
/// generated by this [HttpClient].
|
||||
///
|
||||
/// The default value is `Dart/<version> (dart:io)`.
|
||||
///
|
||||
/// If the userAgent is set to `null`, no default `User-Agent` header will be
|
||||
/// added to each request.
|
||||
String userAgent;
|
||||
|
||||
factory HttpClient({SecurityContext context}) {
|
||||
|
@ -1474,7 +1473,7 @@ abstract class HttpClient {
|
|||
* Opens a HTTP connection using the DELETE method.
|
||||
*
|
||||
* The server is specified using [host] and [port], and the path
|
||||
* (including s possible query) is specified using [path].
|
||||
* (including a possible query) is specified using [path].
|
||||
*
|
||||
* See [open] for details.
|
||||
*/
|
||||
|
@ -1619,7 +1618,7 @@ abstract class HttpClient {
|
|||
* HttpClient client = new HttpClient();
|
||||
* client.findProxy = (url) {
|
||||
* return HttpClient.findProxyFromEnvironment(
|
||||
* url, {"http_proxy": ..., "no_proxy": ...});
|
||||
* url, environment: {"http_proxy": ..., "no_proxy": ...});
|
||||
* }
|
||||
*
|
||||
* If a proxy requires authentication it is possible to configure
|
||||
|
@ -1688,16 +1687,14 @@ abstract class HttpClient {
|
|||
set badCertificateCallback(
|
||||
bool callback(X509Certificate cert, String host, int port));
|
||||
|
||||
/**
|
||||
* Shut down the HTTP client. If [force] is `false` (the default)
|
||||
* the [HttpClient] will be kept alive until all active
|
||||
* connections are done. If [force] is `true` any active
|
||||
* connections will be closed to immediately release all
|
||||
* resources. These closed connections will receive an error
|
||||
* event to indicate that the client was shut down. In both cases
|
||||
* trying to establish a new connection after calling [close]
|
||||
* will throw an exception.
|
||||
*/
|
||||
/// Shuts down the HTTP client.
|
||||
///
|
||||
/// If [force] is `false` (the default) the [HttpClient] will be kept alive
|
||||
/// until all active connections are done. If [force] is `true` any active
|
||||
/// connections will be closed to immediately release all resources. These
|
||||
/// closed connections will receive an error event to indicate that the client
|
||||
/// was shut down. In both cases trying to establish a new connection after
|
||||
/// calling [close] will throw an exception.
|
||||
void close({bool force: false});
|
||||
}
|
||||
|
||||
|
@ -1744,7 +1741,7 @@ abstract class HttpClientRequest implements IOSink {
|
|||
* 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:]
|
||||
* and only for the status codes [:HttpStatus.MOVED_PERMANENTLY:]
|
||||
* (301), [:HttpStatus.FOUND:] (302),
|
||||
* [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
|
||||
* [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
|
||||
|
@ -1778,15 +1775,14 @@ abstract class HttpClientRequest implements IOSink {
|
|||
*/
|
||||
Uri get uri;
|
||||
|
||||
/**
|
||||
* Gets and sets the content length of the request. If the size of
|
||||
* the request is not known in advance set content length to -1,
|
||||
* which is also the default.
|
||||
*/
|
||||
/// Gets and sets the content length of the request.
|
||||
///
|
||||
/// If the size of the request is not known in advance set content length to
|
||||
/// -1, which is also the default.
|
||||
int contentLength;
|
||||
|
||||
/**
|
||||
* Get or set if the [HttpClientRequest] should buffer output.
|
||||
* Gets or sets if the [HttpClientRequest] should buffer output.
|
||||
*
|
||||
* Default value is `true`.
|
||||
*
|
||||
|
@ -1809,11 +1805,11 @@ abstract class HttpClientRequest implements IOSink {
|
|||
*/
|
||||
List<Cookie> get cookies;
|
||||
|
||||
/**
|
||||
* A [HttpClientResponse] future that will complete once the response is
|
||||
* available. If an error occurs before the response is available, this
|
||||
* future will complete with an error.
|
||||
*/
|
||||
/// A [HttpClientResponse] future that will complete once the response is
|
||||
/// available.
|
||||
///
|
||||
/// If an error occurs before the response is available, this future will
|
||||
/// complete with an error.
|
||||
Future<HttpClientResponse> get done;
|
||||
|
||||
/**
|
||||
|
@ -1821,10 +1817,9 @@ abstract class HttpClientRequest implements IOSink {
|
|||
*/
|
||||
Future<HttpClientResponse> close();
|
||||
|
||||
/**
|
||||
* Get information about the client connection. Returns [:null:] if the socket
|
||||
* is not available.
|
||||
*/
|
||||
/// Gets information about the client connection.
|
||||
///
|
||||
/// Returns [:null:] if the socket is not available.
|
||||
HttpConnectionInfo get connectionInfo;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue