Container class for HTTP responses


package ArangoDBClient
since 0.2

 Methods

Set up the response

__construct(string $responseString, string $originUrl = null, string $originMethod = null, boolean $wasAsync = false

Parameters

$responseString

string
  • the complete HTTP response as supplied by the server

$originUrl

string

The original URL the response is coming from

$originMethod

string

The HTTP method that was used when sending data to the origin URL

$wasAsync

boolean

Exceptions

\ArangoDBClient\ClientException

getBatchPart()

getBatchPart() : \ArangoDBClient\Batchpart

Returns

\ArangoDBClient\Batchpart

Return the body of the response

getBody() : string

Returns

string- body of the response

Return an individual HTTP headers of the response

getHeader(string $name) : string

Parameters

$name

string
  • name of header

Returns

string- header value, NULL if header wasn't set in response

Return the HTTP headers of the response

getHeaders() : array

Returns

array- array of all headers with values

Return the HTTP status code of the response

getHttpCode() : integer

Returns

integer- HTTP status code of response

Return the data from the JSON-encoded body

getJson() : array

Exceptions

\ArangoDBClient\ClientException

Returns

array- array of values from the JSON-encoded response body

Return the leader location HTTP header of the response

getLeaderEndpointHeader() : string

Returns

string- header value, NULL is header wasn't set in response

Return the location HTTP header of the response

getLocationHeader() : string

Returns

string- header value, NULL is header wasn't set in response

Return the result line (first header line) of the response

getResult() : string

Returns

string- the result line (first line of header)

setBatchPart()

setBatchPart(\ArangoDBClient\Batchpart $batchPart) : \ArangoDBClient\HttpResponse

Parameters

$batchPart

\ArangoDBClient\Batchpart

Returns

\ArangoDBClient\HttpResponse

 Properties

 

The body retrieved

$_body : string

Default

''
 

The header retrieved

$_header : string

Default

''
 

All headers retrieved as an assoc array

$_headers : array

Default

array()
 

The HTTP status code of the response

$_httpCode : integer

Default

 

The result status-line (first line of HTTP response header)

$_result : string

Default

''
 

Whether or not the response is for an async request without a response body

$_wasAsync : boolean

Default

false
 

Whether or not the response is for an async request without a response body

$batchPart : \ArangoDBClient\Batchpart

Default

 Constants

 

HTTP leader endpoint header, used in failover

HEADER_LEADER_ENDPOINT = 'x-arango-endpoint' 
 

HTTP location header

HEADER_LOCATION = 'location'