diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
index 62f7343..2c46fd8 100644
a
|
b
|
class WP_REST_Server { |
780 | 780 | $callback = $handler['callback']; |
781 | 781 | $response = null; |
782 | 782 | |
783 | | if ( empty( $handler['methods'][ $method ] ) ) { |
| 783 | $checked_method = 'HEAD' === $method ? 'GET' : $method; |
| 784 | if ( empty( $handler['methods'][ $checked_method ] ) ) { |
784 | 785 | continue; |
785 | 786 | } |
786 | 787 | |
diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php
index 248ba56..c9431f0 100644
a
|
b
|
class Tests_REST_Server extends WP_Test_REST_TestCase { |
121 | 121 | $this->assertEquals( array( 'foo' => 'bar' ), $request->get_params() ); |
122 | 122 | } |
123 | 123 | |
| 124 | public function test_head_request_handled_by_get() { |
| 125 | register_rest_route( 'head-request', '/test', array( |
| 126 | 'methods' => array( 'GET' ), |
| 127 | 'callback' => '__return_true', |
| 128 | ) ); |
| 129 | $request = new WP_REST_Request( 'HEAD', '/head-request/test' ); |
| 130 | $response = $this->server->dispatch( $request ); |
| 131 | $this->assertEquals( 200, $response->get_status() ); |
| 132 | } |
| 133 | |
124 | 134 | /** |
125 | 135 | * Pass a capability which the user does not have, this should |
126 | 136 | * result in a 403 error. |