Opened 11 years ago
Closed 11 years ago
#34841 closed enhancement (fixed)
Support for registering HEAD callback in REST API
| Reported by: | danielbachhuber | Owned by: | rmccue |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.5 |
| Component: | REST API | Version: | |
| Severity: | normal | Keywords: | has-patch 2nd-opinion |
| Cc: | Focuses: |
Description
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.
Discussion: https://wordpress.slack.com/archives/core/p1449160413002916
Attachments (2)
Change History (5)
#1
@
11 years ago
- Keywords has-patch 2nd-opinion added; needs-patch removed
- Milestone Future Release → 4.5
- Owner set to
- Status new → 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.
Allow registering HEAD endpoints