WordPress at a glance
function is not described

rest_ensure_request() WP 4.4.0

Ensures request arguments are a request object (for consistency).

No Hooks.

Return

WP_REST_Request. REST request instance.

Usage

rest_ensure_request( $request );
$request(array/WP_REST_Request) (required)
Request to check.

Code of rest ensure request: wp-includes/rest-api.php WP 5.2.1

<?php
function rest_ensure_request( $request ) {
	if ( $request instanceof WP_REST_Request ) {
		return $request;
	}

	return new WP_REST_Request( 'GET', '', $request );
}