WordPress at a glance
filter is not described

rest_pre_serve_request filter-hook . WP 4.4.0

Filters whether the request has already been served.

Allow sending the request manually - by returning true, the API result will not be sent to the client.

Usage

add_filter( 'rest_pre_serve_request', 'filter_function_name_1099', 10, 4 );
function filter_function_name_1099( $served, $result, $request, $this ){
	// filter...

	return $served;
}
$served(true/false)
Whether the request has already been served.
Default: false
$result(WP_HTTP_Response)
Result to send to the client. Usually a WP_REST_Response.
$request(WP_REST_Request)
Request used to generate the response.
$this(WP_REST_Server)
Server instance.

Where the hook is called

WP_REST_Server::serve_request()
wp-includes/rest-api/class-wp-rest-server.php 372
$served = apply_filters( 'rest_pre_serve_request', false, $result, $request, $this );

Where the hook is used (in WP core)

wp-includes/rest-api.php 166
add_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
wp-includes/default-filters.php 532
add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );