Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34837 closed defect (bug) (fixed)

Fix handling of HEAD requests in WP_REST_Server

Reported by: danielbachhuber's profile danielbachhuber Owned by: markjaquith's profile markjaquith
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

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 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.

Attachments (1)

34837.1.diff (1.4 KB) - added by danielbachhuber 9 years ago.

Download all attachments as: .zip

Change History (5)

#1 @markjaquith
9 years ago

  • Keywords 2nd-opinion added

Looks good. Asking for secondary review.

This ticket was mentioned in Slack in #core by mark. View the logs.


9 years ago

#3 @helen
9 years ago

  • Keywords commit added; 2nd-opinion removed

Go forth.

#4 @markjaquith
9 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In 35758:

Route HEAD API requests through the GET callback method

fixes #34837
props danielbachhuber

Note: See TracTickets for help on using tickets.