classafButter::HttpRequestHeaders
sys::Obj afButter::HttpRequestHeaders
A wrapper for HTTP request headers with accessors for commonly used headings. Set a value to null to remove it from the map. Backed by a case insensitive map.
@see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- accept
QualityValues? acceptContent-Types that are acceptable for the response.
Example:
Accept: audio/*; q=0.2, audio/basicReturns
nullif the header doesn't exist.- acceptEncoding
QualityValues? acceptEncodingList of acceptable encodings.
Example:
Accept-Encoding: compress;q=0.5, gzip;q=1.0Returns
nullif the header doesn't exist.- acceptLanguage
QualityValues? acceptLanguageList of acceptable human languages for response.
Example:
Accept-Language: da, en-gb;q=0.8, en;q=0.7Returns
nullif the header doesn't exist.Str? authorizationAuthorization header. For BASIC authorisation, encode the credentials like this:
headers.authorization = "BASIC " + "${username}:${password}".toBuf.toBase64Example:
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1lReturns
nullif the header doesn't exist.- containsKey
Returns
trueif the given header has been set- contentLength
Int? contentLengthThe length of the request body in octets (8-bit bytes).
Example:
Content-Length: 348Returns
nullif the header doesn't exist.- contentType
MimeType? contentTypeThe MIME type of the body of the request (mainly used with POST and PUT requests).
Example:
Content-Type: application/x-www-form-urlencodedReturns
nullif the header doesn't exist.Cookie[]? cookieHTTP cookies previously sent by the server with
Set-Cookie.Example:
Cookie: Version=1; Skin=new;Returns
nullif the header doesn't exist.- each
Iterates over the headers.
- get
Simple getter for setting raw Str values.
- host
Str? hostThe domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested.
Example:
Host: www.alienfactory.co.uk:8069Returns
nullif the header doesn't exist.- ifModifiedSince
DateTime? ifModifiedSinceAllows a 304 Not Modified to be returned if content is unchanged.
Example:
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMTReturns
nullif the header doesn't exist.- ifNoneMatch
Str? ifNoneMatchAllows a 304 Not Modified to be returned if content is unchanged.
Example:
If-None-Match: "737060cd8c284d8af7ad3082f209582d"Returns
nullif the header doesn't exist.- make
new make([Str:Str]? headers := null)Creates
HttpRequestHeaderscopying over values in the given map.- origin
Uri? originInitiates a request for cross-origin resource sharing.
Example:
Origin: http://www.example-social-network.comReturns
nullif the header doesn't exist.- referrer
Uri? referrerThis is the address of the previous web page from which a link to the currently requested page was followed.
Example:
Referer: http://en.wikipedia.org/wiki/Main_PageReturns
nullif the header doesn't exist.- set
@Operator
Void set(Str name, Str? value)Simple setter for getting raw Str values. Setting a
nullvalue removes the value from the map.- toStr
virtual override Str toStr()- userAgent
Str? userAgentThe user agent string of the user agent.
Example:
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/21.0Returns
nullif the header doesn't exist.- val
Returns the case insensitive map that backs the headers.
- xForwardedFor
Str[]? xForwardedForIdentifies the originating IP address of a client connecting through an HTTP proxy.
Example:
X-Forwarded-For: client, proxy1, proxy2Returns
nullif the header doesn't exist.- xRequestedWith
Str? xRequestedWithMainly used to identify Ajax requests.
Example:
X-Requested-With: XMLHttpRequestReturns
nullif the header doesn't exist.