WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34837 closed defect (bug) (fixed)

Fix handling of HEAD requests in WP_REST_Server

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

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 4 years ago.

Download all attachments as: .zip

Change History (5)

#1 @markjaquith
4 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.


4 years ago

#3 @helen
4 years ago

  • Keywords commit added; 2nd-opinion removed

Go forth.

#4 @markjaquith
4 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.