Make WordPress Core


Ignore:
Timestamp:
11/03/2016 08:04:59 PM (8 years ago)
Author:
rachelbaker
Message:

REST API: Modify the structure of our DELETE responses to be more explicit.

Add the deleted property to the root of the Response object to communicate if the delete action was successful. Move the state of the resource prior to the delete request under a new previous property. As a result DELETE responses are now structured like so:

{ deleted: true, previous: { ... } }

Also includes helpful information to DELETE requests for resources that are not trashable.

Props timmydcrawford, rmccue, jnylen0.
Fixes #38494.

File:
1 edited

Legend:

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

    r39104 r39126  
    731731        $this->assertErrorResponse( 'rest_trash_not_supported', $response, 501 );
    732732
     733        $request->set_param( 'force', 'false' );
     734        $response = $this->server->dispatch( $request );
     735        $this->assertErrorResponse( 'rest_trash_not_supported', $response, 501 );
     736
    733737        // Ensure the post still exists
    734738        $post = get_post( $attachment_id );
Note: See TracChangeset for help on using the changeset viewer.