WordPress.org

Make WordPress Core

Changeset 38990


Ignore:
Timestamp:
10/28/2016 02:06:17 AM (4 years ago)
Author:
pento
Message:

REST API: Revert [38980].

/users/me still needs attention, but this change wasn't quite ready.

See #38521.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r38980 r38990  
    289289        $response = $this->prepare_item_for_response( $user, $request );
    290290        $response = rest_ensure_response( $response );
     291        $response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $current_user_id ) ) );
     292        $response->set_status( 302 );
    291293
    292294        return $response;
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r38980 r38990  
    636636
    637637        $response = $this->server->dispatch( $request );
    638         $this->assertEquals( 200, $response->get_status() );
     638        $this->assertEquals( 302, $response->get_status() );
    639639
    640640        $headers = $response->get_headers();
    641         $this->assertArrayNotHasKey( 'Location', $headers );
    642 
    643         $links = $response->get_links();
    644         $this->assertEquals( rest_url( 'wp/v2/users/' . self::$user ), $links['self'][0]['href'] );
     641        $this->assertArrayHasKey( 'Location', $headers );
     642        $this->assertEquals( rest_url( 'wp/v2/users/' . self::$user ), $headers['Location'] );
    645643    }
    646644
Note: See TracChangeset for help on using the changeset viewer.