WP_AI_Client_HTTP_Client::prepare_body( WordPressAiClientDependenciesPsrHttpMessageRequestInterface $request ): string|null

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 request body for WordPress HTTP API.

Parameters

$requestWordPressAiClientDependenciesPsrHttpMessageRequestInterfacerequired
The PSR-7 request.

Return

string|null The request body.

Source

private function prepare_body( RequestInterface $request ): ?string {
	$body = $request->getBody();

	if ( $body->getSize() === 0 ) {
		return null;
	}

	if ( $body->isSeekable() ) {
		$body->rewind();
	}

	return (string) $body;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

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