#42828 closed defect (bug) (fixed)
Hard-coded 403 status in REST response should use `rest_authorization_required_code()`
| Reported by: | jaswrks | Owned by: | rachelbaker |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.9.2 |
| Component: | REST API | Version: | 4.7 |
| Severity: | normal | Keywords: | commit |
| Cc: | Focuses: | rest-api |
Description
Line 911 in the WP_REST_Server class currently uses a hard-coded 403 error code. It should be calling upon rest_authorization_required_code() to determine the proper response code; e.g., 401 instead of a 403 whenever a user is not logged-in.
<?php $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => 403 ) );
Should be:
<?php $response = new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.' ), array( 'status' => rest_authorization_required_code() ) );
Attachments (1)
Change History (7)
Note:
See TracTickets
for help on using tickets.
In 42421: