Ticket #38521: 38521.diff
| File 38521.diff, 1.6 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
288 288 $user = wp_get_current_user(); 289 289 $response = $this->prepare_item_for_response( $user, $request ); 290 290 $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 );293 291 294 292 return $response; 295 293 } -
tests/phpunit/tests/rest-api/rest-users-controller.php
627 627 $request = new WP_REST_Request( 'GET', '/wp/v2/users/me' ); 628 628 629 629 $response = $this->server->dispatch( $request ); 630 $this->assertEquals( 302, $response->get_status() );630 $this->assertEquals( 200, $response->get_status() ); 631 631 632 632 $headers = $response->get_headers(); 633 $this->assertArrayHasKey( 'Location', $headers ); 634 $this->assertEquals( rest_url( 'wp/v2/users/' . $this->user ), $headers['Location'] ); 633 $this->assertArrayNotHasKey( 'Location', $headers ); 634 635 $links = $response->get_links(); 636 $this->assertEquals( 637 rest_url( 'wp/v2/users/' . $this->user ), 638 $links['self'][0]['href'] 639 ); 635 640 } 636 641 637 642 public function test_get_current_user_without_permission() {