HyperResponse
The HyperResponse component is a read-only wrapper to easily grab different information about the response.
getResponseId
getResponseIdGets the unique response ID representing this response.
No arguments
Return: String
getStatusCode
getStatusCodeGets the status code for the response.
No arguments
Return: numeric
getStatusText
getStatusTextGets the status text for the response.
No arguments
Return: String
getStatus
getStatusReturns the status code and status text as a single string.
No arguments
Return: String
getData
getDataGets the data for the response.
No arguments
Return: String
getRequestID
getRequestIDReturns the id of the request to which this response is related.
No arguments
Return: String
getRequest
getRequestGets the HyperRequest instance associated with this response.
No arguments
Return: HyperRequest
getCharset
getCharsetGets the charset value for the response.
No arguments
Return: String
getTimestamp
getTimestampGets the timestamp for when this response was received.
No arguments
Return: DateTime
getExecutionTime
getExecutionTimeGets the execution time of the request, in milliseconds.
No arguments
Return: numeric
json
jsonReturns the data of the request as deserialized JSON.
Throws: DeserializeJsonException if the response is not JSON.
No arguments
Return: any
isSuccess
isSuccessReturns true if the request status code is considered successful.
No arguments
Return: boolean
isOK
isOKReturns true if the request status code is 200 OK.
No arguments
Return: boolean
isCreated
isCreatedReturns true if the request status code is 201 Created.
No arguments
Return: boolean
isRedirect
isRedirectReturns true if the request status code is considered a redirect.
No arguments
Return: boolean
isError
isErrorReturns true if the request status code is considered either a client error (4xx status code) or a server error (5xx status code).
No arguments
Return: boolean
isClientError
isClientErrorReturns true if the request status code is considered a client error (4xx status code).
No arguments
Return: boolean
isUnauthorized
isUnauthorizedReturns true if the request status code is 401 Unauthorized.
No arguments
Return: boolean
isForbidden
isForbiddenReturns true if the request status code is 403 Forbidden.
No arguments
Return: boolean
isNotFound
isNotFoundReturns true if the request status code is 404 Not Found.
No arguments
Return: boolean
isServerError
isServerErrorReturns true if the request status code is considered a server error (5xx status code).
No arguments
Return: boolean
hasHeader
hasHeaderChecks if a header exists in the response.
name
String
true
The name of the header to check.
Return: boolean
getHeader
getHeaderGets the value of a header from the response.
name
String
true
The name of the header to retrieve.
defaultValue
any
false
""
The value to return if the header does not exist.
Return: any
getCookies
getCookiesCaches the result of parsing the Set-Cookie header and returns it.
No arguments
Return: struct
persistCookies
persistCookiesParses and saves the cookies to the cookie scope.
No arguments
Return: HyperResponse
getMemento
getMementoGets a serializable representation of the response.
No arguments
Return:
{
    "responseID"    : getResponseID(),
    "requestID"     : getRequestID(),
    "statusCode"    : getStatusCode(),
    "statusText"    : getStatusText(),
    "status"        : getStatus(),
    "data"          : getData(),
    "charset"       : getCharset(),
    "headers"       : getHeaders(),
    "timestamp"     : getTimestamp(),
    "executionTime" : getExecutionTime(),
    "cookies"       : getCookies()
}
