mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
OPTIONS requests to REST API should return Allow header.
An OPTIONS request was incorrectly returning an "Accept" header which was a typo of "Allow". This meant Accept was showing "GET, POST" for example, however it was also not running the permission checks on the endpoints. Instead, the correct route needs to be set on the request object, which means the normal handling for the Allow header will kick in. This technically breaks backwards compatibility, however given the value of Accept was also wrong then this should not be an issue. Fixes #35975. git-svn-id: https://develop.svn.wordpress.org/trunk@36829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -431,10 +431,9 @@ function rest_handle_options_request( $response, $handler, $request ) {
|
||||
}
|
||||
|
||||
$data = $handler->get_data_for_route( $route, $endpoints, 'help' );
|
||||
$accept = array_merge( $accept, $data['methods'] );
|
||||
$response->set_matched_route( $route );
|
||||
break;
|
||||
}
|
||||
$response->header( 'Accept', implode( ', ', $accept ) );
|
||||
|
||||
$response->set_data( $data );
|
||||
return $response;
|
||||
|
||||
Reference in New Issue
Block a user