[wp-trac] [WordPress Trac] #35975: OPTIONS request to REST API does not return correct Accept header
WordPress Trac
noreply at wordpress.org
Sat Feb 27 09:52:06 UTC 2016
#35975: OPTIONS request to REST API does not return correct Accept header
--------------------------+-----------------
Reporter: joehoyle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.5
Component: REST API | Version: 4.4
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------
The REST API should (and usually does) send an Accept header along with
requests to tell the client what over HTTP verbs can be sent. This is
determined by 1: the endpoint registration for those methods, and 2: by
running the `permission_callback` on the endpoint to see if the request
''could'' run the request.
In the event of an OPTIONS request, which is the ''typical'' use case for
wanting to see what requests can be accepted, we are not running the
`permission_callback` on the endpoints, which means the Accept is not
true.
This is a bug, caused by the shortcircuited routing in the OPTIONS request
handling, specifically the `matched_route` is not set on the Response
object, so the Accept handler can not determine what permission checks to
run.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35975>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list