WP_AI_Client_HTTP_Client::prepare_wp_args( WordPressAiClientDependenciesPsrHttpMessageRequestInterface $request, WordPressAiClientProvidersHttpDTORequestOptions|null $options = null ): array<string,

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

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

Return

array<string, mixed> WordPress HTTP API arguments.

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

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.