mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
REST API: Do not include the password argument when getting media items
Currently, `attachment` is the only post type exposed via the REST API that does not support password protection, but it's possible for other post types to remove password support. Fixes #38977. git-svn-id: https://develop.svn.wordpress.org/trunk@39595 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -172,6 +172,19 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
$this->assertEqualSets( $media_types, $data['endpoints'][0]['args']['media_type']['enum'] );
|
||||
}
|
||||
|
||||
public function test_registered_get_item_params() {
|
||||
$id1 = $this->factory->attachment->create_object( $this->test_file, 0, array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'post_excerpt' => 'A sample caption',
|
||||
) );
|
||||
$request = new WP_REST_Request( 'OPTIONS', sprintf( '/wp/v2/media/%d', $id1 ) );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$keys = array_keys( $data['endpoints'][0]['args'] );
|
||||
sort( $keys );
|
||||
$this->assertEquals( array( 'context' ), $keys );
|
||||
}
|
||||
|
||||
public function test_get_items() {
|
||||
wp_set_current_user( 0 );
|
||||
$id1 = $this->factory->attachment->create_object( $this->test_file, 0, array(
|
||||
|
||||
Reference in New Issue
Block a user