Make WordPress Core


Ignore:
Timestamp:
12/13/2018 08:46:19 PM (6 years ago)
Author:
desrosj
Message:

REST API: Introduce the rest_preload_api_request() function.

This function helps perform multiple REST API requests, for the purpose of preloading data into a page.

Props pento.

Merges [43763] to trunk.

See #45110.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tests/phpunit/tests/rest-api.php

    r43571 r44123  
    713713        $this->assertEquals( $routes['/test-ns/test'][0]['methods'], array( 'GET' => true ) );
    714714    }
     715
     716    /**
     717     * Ensure rest_preload_api_request() works without notices in PHP 5.2.
     718     *
     719     * The array_reduce() function only accepts mixed variables starting with PHP 5.3.
     720     */
     721    function test_rest_preload_api_request_no_notices_php_52() {
     722        $this->assertTrue( is_array( rest_preload_api_request( 0, '/' ) ) );
     723    }
    715724}
Note: See TracChangeset for help on using the changeset viewer.