| Index: sdk/lib/io/http.dart
|
| diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
|
| index feaeb0e4edbd1e7e9066dcc7f782e18df095cdb0..e50dc2acd4ac6461f43c8d8226666b91ba57cd59 100644
|
| --- a/sdk/lib/io/http.dart
|
| +++ b/sdk/lib/io/http.dart
|
| @@ -399,9 +399,7 @@ abstract class HttpHeaders {
|
| * use code like this:
|
| *
|
| * HttpClientRequest request = ...;
|
| - * var v = new HeaderValue();
|
| - * v.value = "text/plain";
|
| - * v.parameters["q"] = "0.3"
|
| + * var v = new HeaderValue("text/plain", {"q": "0.3"});
|
| * request.headers.add(HttpHeaders.ACCEPT, v);
|
| * request.headers.add(HttpHeaders.ACCEPT, "text/html");
|
| *
|
| @@ -413,12 +411,16 @@ abstract class HttpHeaders {
|
| * HeaderValue v = new HeaderValue.fromString(value);
|
| * // Use v.value and v.parameters
|
| * });
|
| + *
|
| + * An instance of [HeaderValue] is immutable.
|
| */
|
| abstract class HeaderValue {
|
| /**
|
| * Creates a new header value object setting the value part.
|
| */
|
| - factory HeaderValue([String value = ""]) => new _HeaderValue(value);
|
| + factory HeaderValue([String value = "", Map<String, String> parameters]) {
|
| + return new _HeaderValue(value, parameters);
|
| + }
|
|
|
| /**
|
| * Creates a new header value object from parsing a header value
|
| @@ -431,9 +433,9 @@ abstract class HeaderValue {
|
| }
|
|
|
| /**
|
| - * Gets and sets the header value.
|
| + * Gets the header value.
|
| */
|
| - String value;
|
| + String get value;
|
|
|
| /**
|
| * Gets the map of parameters.
|
| @@ -473,15 +475,18 @@ abstract class HttpSession implements Map {
|
|
|
|
|
| /**
|
| - * Representation of a content type.
|
| + * Representation of a content type. An instance of [ContentType] is
|
| + * immutable.
|
| */
|
| abstract class ContentType implements HeaderValue {
|
| /**
|
| * Creates a new content type object setting the primary type and
|
| - * sub type.
|
| + * sub type and the charset parameter.
|
| */
|
| - factory ContentType([String primaryType = "", String subType = ""]) {
|
| - return new _ContentType(primaryType, subType);
|
| + factory ContentType([String primaryType = "",
|
| + String subType = "",
|
| + String charset]) {
|
| + return new _ContentType(primaryType, subType, charset);
|
| }
|
|
|
| /**
|
| @@ -500,24 +505,19 @@ abstract class ContentType implements HeaderValue {
|
| }
|
|
|
| /**
|
| - * Gets and sets the content type in the form "primaryType/subType".
|
| - */
|
| - String value;
|
| -
|
| - /**
|
| - * Gets and sets the primary type.
|
| + * Gets the primary type.
|
| */
|
| - String primaryType;
|
| + String get primaryType;
|
|
|
| /**
|
| - * Gets and sets the sub type.
|
| + * Gets the sub type.
|
| */
|
| - String subType;
|
| + String get subType;
|
|
|
| /**
|
| - * Gets and sets the character set.
|
| + * Gets the character set.
|
| */
|
| - String charset;
|
| + String get charset;
|
| }
|
|
|
|
|
|
|