The HyperResponse
component is a read-only wrapper to easily grab different information about the response.
getResponseId
Gets the unique response ID representing this response.
Name | Type | Required | Default | Description |
---|---|---|---|---|
Return: String
getStatusCode
Gets the status code for the response.
Name | Type | Required | Default | Description |
---|---|---|---|---|
Return: numeric
getStatusText
Gets the status text for the response.
Name | Type | Required | Default | Description |
---|---|---|---|---|
Return: String
getStatus
Returns the status code and status text as a single string.
Return: String
getData
Gets the data for the response.
Return: String
getRequestID
Returns the id of the request to which this response is related.
Return: String
getRequest
Gets the HyperRequest instance associated with this response.
Return: HyperRequest
getCharset
Gets the charset value for the response.
Return: String
getTimestamp
Gets the timestamp for when this response was received.
Return: DateTime
getExecutionTime
Gets the execution time of the request, in milliseconds.
Return: numeric
json
Returns the data of the request as deserialized JSON
.
Throws: DeserializeJsonException
if the response is not JSON
.
Return: any
isSuccess
Returns true if the request status code is considered successful.
Return: boolean
isOK
Returns true if the request status code is 200 OK
.
Return: boolean
isCreated
Returns true if the request status code is 201 Created
.
Return: boolean
isRedirect
Returns true if the request status code is considered a redirect.
Return: boolean
isError
Returns true if the request status code is considered either a client error (4xx status code) or a server error (5xx status code).
Return: boolean
isClientError
Returns true if the request status code is considered a client error (4xx status code).
Return: boolean
isUnauthorized
Returns true if the request status code is 401 Unauthorized
.
Return: boolean
isForbidden
Returns true if the request status code is 403 Forbidden
.
Return: boolean
isNotFound
Returns true if the request status code is 404 Not Found
.
Return: boolean
isServerError
Returns true if the request status code is considered a server error (5xx status code).
Return: boolean
hasHeader
Checks if a header exists in the response.
Return: boolean
getHeader
Gets the value of a header from the response.
Return: any
getCookies
Caches the result of parsing the Set-Cookie
header and returns it.
Return: struct
persistCookies
Parses and saves the cookies to the cookie scope.
Return: HyperResponse
getMemento
Gets a serializable representation of the response.
Return:
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
Name | Type | Required | Default | Description |
---|---|---|---|---|
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
No arguments
name
String
true
The name of the header to check.
name
String
true
The name of the header to retrieve.
defaultValue
any
false
""
The value to return if the header does not exist.
No arguments
No arguments
No arguments