Make WordPress Core


Ignore:
Timestamp:
11/09/2021 01:57:48 AM (3 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Add batch support for posts and terms controllers.

This also exposes the value of allow_batch in OPTIONS requests to a route.

A future commit will add batch support to more resources.

Props spacedmonkey, chrisvanpatten.
See #53063.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r51568 r52068  
    161161        $response = rest_get_server()->dispatch( $request );
    162162        $data     = $response->get_data();
     163        $this->assertArrayNotHasKey( 'allow_batch', $data['endpoints'][0] );
    163164        $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] );
    164165        $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
     
    175176        $response      = rest_get_server()->dispatch( $request );
    176177        $data          = $response->get_data();
     178        $this->assertArrayNotHasKey( 'allow_batch', $data['endpoints'][0] );
    177179        $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] );
    178180        $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
Note: See TracChangeset for help on using the changeset viewer.