Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#34841 closed enhancement (fixed)

Support for registering HEAD callback in REST API

Reported by: danielbachhuber's profile danielbachhuber Owned by: rmccue's profile rmccue
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch 2nd-opinion
Focuses: Cc:


From #34837

It should be possible to register an optional HEAD callback for an endpoint. However, if no HEAD callback is provided, the REST API should fall back to the GET callback.


Attachments (2)

34841.diff (694 bytes) - added by rmccue 9 years ago.
Allow registering HEAD endpoints
34841.2.diff (695 bytes) - added by rachelbaker 8 years ago.
Add period at end of inline comment

Download all attachments as: .zip

Change History (5)

9 years ago

Allow registering HEAD endpoints

#1 @rmccue
9 years ago

  • Keywords has-patch 2nd-opinion added; needs-patch removed
  • Milestone changed from Future Release to 4.5
  • Owner set to rmccue
  • Status changed from new to accepted

Added patch; this requires registering the HEAD endpoint before the GET one. Essentially internally we're now treating GET as GET,HEAD, so this matches the behaviour of first-match we currently have (that is, if you have two endpoints with POST,PUT and POST respectively, a POST will match the first one).

@danielbachhuber @joehoyle @rachelbaker :thumbsup: on the approach? We'll need to make sure it's documented that GET is treated as GET,HEAD.

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.

8 years ago

8 years ago

Add period at end of inline comment

#3 @rmccue
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36535:

REST API: Allow explicit HEAD callbacks.

HEAD callbacks can now be registered independently, with the GET
callback still used as a fallback.

Fixes #34841.

Note: See TracTickets for help on using tickets.