WP_AI_Client_HTTP_Client::prepare_headers( WordPressAiClientDependenciesPsrHttpMessageRequestInterface $request ): 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 headers for WordPress HTTP API.

Parameters

$requestWordPressAiClientDependenciesPsrHttpMessageRequestInterfacerequired
The PSR-7 request.

Return

array<string, string> Headers array for WordPress HTTP API.

Source

private function prepare_headers( RequestInterface $request ): array {
	$headers = array();

	foreach ( $request->getHeaders() as $name => $values ) {
		$headers[ (string) $name ] = implode( ', ', $values );
	}

	return $headers;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

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