Prepares WordPress HTTP API arguments from a PSR-7 request.
Parameters
$requestWordPressAiClientDependenciesPsrHttpMessageRequestInterfacerequired- The PSR-7 request.
$optionsWordPressAiClientProvidersHttpDTORequestOptions|nulloptional- Optional transport options for the request.
Default:
null
Source
private function prepare_wp_args( RequestInterface $request, ?RequestOptions $options = null ): array {
$args = array(
'method' => $request->getMethod(),
'headers' => $this->prepare_headers( $request ),
'body' => $this->prepare_body( $request ),
'httpversion' => $request->getProtocolVersion(),
'blocking' => true,
);
if ( null !== $options ) {
if ( null !== $options->getTimeout() ) {
$args['timeout'] = $options->getTimeout();
}
if ( null !== $options->getMaxRedirects() ) {
$args['redirection'] = $options->getMaxRedirects();
}
}
return $args;
}
Changelog
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.