Dart API Referencedart:ioHttpHeaders

HttpHeaders Interface

Access to the HTTP headers for requests and responses. In some situations the headers will be imutable and the mutating methods will then throw exceptions.

For all operation on HTTP headers the header name is case-insensitive.

Static Fields

Code final ACCEPT #

static final ACCEPT = "Accept";

Code final ACCEPT_CHARSET #

static final ACCEPT_CHARSET = "Accept-Charset";

Code final ACCEPT_ENCODING #

static final ACCEPT_ENCODING = "Accept-Encoding";

Code final ACCEPT_LANGUAGE #

static final ACCEPT_LANGUAGE = "Accept-Language";

Code final ACCEPT_RANGES #

static final ACCEPT_RANGES = "Accept-Ranges";

Code final AGE #

static final AGE = "Age";

Code final ALLOW #

static final ALLOW = "Allow";

Code final AUTHORIZATION #

static final AUTHORIZATION = "Authorization";

Code final CACHE_CONTROL #

static final CACHE_CONTROL = "Cache-Control";

Code final CONNECTION #

static final CONNECTION = "Connection";

Code final CONTENT_ENCODING #

static final CONTENT_ENCODING = "Content-Encoding";

Code final CONTENT_LANGUAGE #

static final CONTENT_LANGUAGE = "Content-Language";

Code final CONTENT_LENGTH #

static final CONTENT_LENGTH = "Content-Length";

Code final CONTENT_LOCATION #

static final CONTENT_LOCATION = "Content-Location";

Code final CONTENT_MD5 #

static final CONTENT_MD5 = "Content-MD5";

Code final CONTENT_RANGE #

static final CONTENT_RANGE = "Content-Range";

Code final CONTENT_TYPE #

static final CONTENT_TYPE = "Content-Type";

Code final DATE #

static final DATE = "Date";

Code final ENTITY_HEADERS #

static final ENTITY_HEADERS = const [ALLOW,
                                     CONTENT-ENCODING,
                                     CONTENT-LANGUAGE,
                                     CONTENT-LENGTH,
                                     CONTENT-LOCATION,
                                     CONTENT-MD5,
                                     CONTENT-RANGE,
                                     CONTENT-TYPE,
                                     EXPIRES,
                                     LAST-MODIFIED];

Code final ETAG #

static final ETAG = "ETag";

Code final EXPECT #

static final EXPECT = "Expect";

Code final EXPIRES #

static final EXPIRES = "Expires";

Code final FROM #

static final FROM = "From";

Code final GENERAL_HEADERS #

static final GENERAL_HEADERS = const [CACHE_CONTROL,
                                      CONNECTION,
                                      DATE,
                                      PRAGMA,
                                      TRAILER,
                                      TRANSFER_ENCODING,
                                      UPGRADE,
                                      VIA,
                                      WARNING];

Code final HOST #

static final HOST = "Host";

Code final IF_MATCH #

static final IF_MATCH = "If-Match";

Code final IF_MODIFIED_SINCE #

static final IF_MODIFIED_SINCE = "If-Modified-Since";

Code final IF_NONE_MATCH #

static final IF_NONE_MATCH = "If-None-Match";

Code final IF_RANGE #

static final IF_RANGE = "If-Range";

Code final IF_UNMODIFIED_SINCE #

static final IF_UNMODIFIED_SINCE = "If-Unmodified-Since";

Code final LAST_MODIFIED #

static final LAST_MODIFIED = "Last-Modified";

Code final LOCATION #

static final LOCATION = "Location";

Code final MAX_FORWARDS #

static final MAX_FORWARDS = "Max-Forwards";

Code final PRAGMA #

static final PRAGMA = "Pragma";

Code final PROXY_AUTHENTICATE #

static final PROXY_AUTHENTICATE = "Proxy-Authenticate";

Code final PROXY_AUTHORIZATION #

static final PROXY_AUTHORIZATION = "Proxy-Authorization";

Code final RANGE #

static final RANGE = "Range";

Code final REFERER #

static final REFERER = "Referer";

Code final REQUEST_HEADERS #

static final REQUEST_HEADERS = const [ACCEPT,
                                      ACCEPT-CHARSET,
                                      ACCEPT-ENCODING,
                                      ACCEPT-LANGUAGE,
                                      AUTHORIZATION,
                                      EXPECT,
                                      FROM,
                                      HOST,
                                      IF-MATCH,
                                      IF-MODIFIED-SINCE,
                                      IF-NONE-MATCH,
                                      IF-RANGE,
                                      IF-UNMODIFIED-SINCE,
                                      MAX-FORWARDS,
                                      PROXY-AUTHORIZATION,
                                      RANGE,
                                      REFERER,
                                      TE,
                                      USER-AGENT];

Code final RESPONSE_HEADERS #

static final RESPONSE_HEADERS = const [ACCEPT-RANGES,
                                       AGE,
                                       ETAG,
                                       LOCATION,
                                       PROXY-AUTHENTICATE,
                                       RETRY-AFTER,
                                       SERVER,
                                       VARY,
                                       WWW-AUTHENTICATE];

Code final RETRY_AFTER #

static final RETRY_AFTER = "Retry-After";

Code final SERVER #

static final SERVER = "Server";

Code final TE #

static final TE = "TE";

Code final TRAILER #

static final TRAILER = "Trailer";

Code final TRANSFER_ENCODING #

static final TRANSFER_ENCODING = "Transfer-Encoding";

Code final UPGRADE #

static final UPGRADE = "Upgrade";

Code final USER_AGENT #

static final USER_AGENT = "User-Agent";

Code final VARY #

static final VARY = "Vary";

Code final VIA #

static final VIA = "Via";

Code final WARNING #

static final WARNING = "Warning";

Code final WWW_AUTHENTICATE #

static final WWW_AUTHENTICATE = "WWW-Authenticate";

Methods

Code void add(String name, Object value) #

Adds a header value. The header named name will have the value value added to its list of values. Some headers are single values and for these adding a value will replace the previous value. If the value is of type Date a HTTP date format will be applied. If the value is a List each element of the list will be added separately. For all other types the default toString method will be used.

void add(String name, Object value);

Code void forEach(void f(String name, List<String> values)) #

Enumerate the headers applying the function f to each header. The header name passed in name will be all lower case.

void forEach(void f(String name, List<String> values));

Code void noFolding(String name) #

Disable folding for the header named name when sending the HTTP header. By default, multiple header values are folded into a single header line by separating the values with commas. The Set-Cookie header has folding disabled by default.

void noFolding(String name);

Code List<String> operator [](String name) #

Returns the list of values for the header named name. If there is no headers with the provided name null will be returned.

List<String> operator[](String name);

Code void remove(String name, Object value) #

Removes a specific value for a header name. Some headers have system supplied values and for these the system supplied values will still be added to the collection of values for the header.

void remove(String name, Object value);

Code void removeAll(String name) #

Remove all values for the specified header name. Some headers have system supplied values and for these the system supplied values will still be added to the collection of values for the header.

void removeAll(String name);

Code void set(String name, Object value) #

Sets a header. The header named name will have all its values cleared before the value value is added as its value.

void set(String name, Object value);

Code String value(String name) #

Convenience method for the value for a single values header. If there is no header with the provided name null will be returned. If the header has more than one value an exception is thrown.

String value(String name);

Fields

Code ContentType contentType #

Gets and sets the content type. Note that the content type in the header will only be updated if this field is set directly. Mutating the returned current value will have no effect.

ContentType contentType;

Code Date date #

Gets and sets the date. The value of this property will reflect the "Date" header

Date date;

Code Date expires #

Gets and sets the expiry date. The value of this property will reflect the "Expires" header

Date expires;

Code String host #

Gets and sets the host part of the "Host" header for the connection.

String host;

Code int port #

Gets and sets the port part of the "Host" header for the connection.

int port;