$_context
$_context : resource|null
Context resource used by the stream API.
Implements sending Cake\Http\Client\Request via php's stream API.
This approach and implementation is partly inspired by Aura.Http
send(\Cake\Http\Client\Request $request, array $options) : array<mixed,\Cake\Http\Client\Response>
Send a request and get a response back.
\Cake\Http\Client\Request | $request | The request object to send. |
array | $options | Array of options for the stream. |
Array of populated Response objects
createResponses(array $headers, string $content) : array<mixed,\Cake\Http\Client\Response>
Create the response list based on the headers & content
Creates one or many response objects based on the number of redirects that occurred.
array | $headers | The list of headers from the request(s) |
string | $content | The response content. |
The list of responses from the request(s)
_buildContext(\Cake\Http\Client\Request $request, array $options) : void
Build the stream context out of the request object.
\Cake\Http\Client\Request | $request | The request to build context from. |
array | $options | Additional request options. |
_buildHeaders(\Cake\Http\Client\Request $request, array $options) : void
Build the header context for the request.
Creates cookies & headers.
\Cake\Http\Client\Request | $request | The request being sent. |
array | $options | Array of options to use. |
_buildContent(\Cake\Http\Client\Request $request, array $options) : void
Builds the request content based on the request object.
If the $request->body() is a string, it will be used as is. Array data will be processed with Cake\Http\Client\FormData
\Cake\Http\Client\Request | $request | The request being sent. |
array | $options | Array of options to use. |
_buildOptions(\Cake\Http\Client\Request $request, array $options) : void
Build miscellaneous options for the request.
\Cake\Http\Client\Request | $request | The request being sent. |
array | $options | Array of options to use. |
_buildSslContext(\Cake\Http\Client\Request $request, array $options) : void
Build SSL options for the request.
\Cake\Http\Client\Request | $request | The request being sent. |
array | $options | Array of options to use. |
_send(\Cake\Http\Client\Request $request) : array
Open the stream and send the request.
\Cake\Http\Client\Request | $request | The request object. |
Array of populated Response objects
_buildResponse(array $headers, string $body) : \Cake\Http\Client\Response
Build a response object
array | $headers | Unparsed headers. |
string | $body | The response body. |