: methods for HTTP responses. All the following examples assume that `response` is an instance of this class. ### Get header values Header names are case-insensitive, but normalized to Title-Case when the response is parsed. ``` val = response.getHeaderLine("content-type"); ``` Will read the Content-Type header. You can get all set headers using: ``` response.getHeaders(); ``` ### Get the response body You can access the response body stream using: ``` content = response.getBody(); ``` You can get the body string using: ``` content = response.getStringBody(); ``` If your response body is in XML or Json you can use special content type specific accessors to read the decoded data. Json data will be returned as arrays, while XML data will be returned as SimpleXML nodes: ``` Get as XML content = response.getXml() Get as Json content = response.getJson() ``` If the response cannot be decoded, null will be returned. ### Check the status code You can access the response status code using: ``` content = response.statusCode(); ```
Inherited | Abstract | Final | Static | Datatype | Header |
---|---|---|---|---|---|
bool | bool isOk() | ||||
ICookieCollection | ICookieCollection buildCookieCollection() | ||||
SimpleXMLElement | SimpleXMLElement getXml() | ||||
bool | bool isRedirect() | ||||
CookieCollection | CookieCollection getCookieCollection() | ||||
this(string[] | this(string[] unparsedHeaders = null, string responseBody = null) | ||||
Json[string] | Json[string] getCookies() | ||||
Json | Json getJson() | ||||
string | string getEncoding() | ||||
string | string getStringBody() | ||||
void | void _parseHeaders(string[] headersToParse) | ||||
auto | auto withStatus(int statusCode, string reasonPhrase = null) | ||||
Json[string] | Json[string] getCookieData(string key) | ||||
Json[string] | Json[string] _getCookies() | ||||
string | string _getBody() | ||||
ISimpleXMLElement | ISimpleXMLElement _getXml() | ||||
string[] | string[] getCookie(string aName) | ||||
Json | Json _getJson() | ||||
bool | bool isSuccess() | ||||
string | string _decodeGzipBody(string encodedBody) | ||||
STRINGAA | STRINGAA _getHeaders() | ||||
string | string getReasonPhrase() | ||||
int | int statusCode() |