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