[wp-trac] [WordPress Trac] #34837: Fix handling of HEAD requests in WP_REST_Server

WordPress Trac noreply at wordpress.org
Thu Dec 3 14:46:33 UTC 2015


#34837: Fix handling of HEAD requests in WP_REST_Server
-----------------------------+--------------------------------------
 Reporter:  danielbachhuber  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  4.4
Component:  REST API         |    Version:  trunk
 Severity:  normal           |   Keywords:  has-patch has-unit-tests
  Focuses:                   |
-----------------------------+--------------------------------------
 `HEAD` request handling has been broken in all of the 2.x betas because,
 surprise, there was no test coverage for it.

 The intended behavior for a `HEAD` request is to use the `GET` callback
 method. See how this is [https://github.com/WP-API/WP-API/blob/1.2.4/lib
 /class-wp-json-server.php#L339-L350 handled in 1.2.4]

 {{{
 public function dispatch() {
         switch ( $this->method ) {
             case 'HEAD':
             case 'GET':
                 $method = self::METHOD_GET;
                 break;
 }}}

 We should do equivalent in the REST server infrastructure.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34837>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list