Opened 9 years ago
Closed 9 years ago
#34841 closed enhancement (fixed)
Support for registering HEAD callback in REST API
Reported by: | danielbachhuber | Owned by: | rmccue |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
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
@
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
.
Allow registering HEAD endpoints