#42828 closed defect (bug) (fixed)
Hard-coded 403 status in REST response should use `rest_authorization_required_code()`
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.9.2 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | REST API | Keywords: | commit |
| Focuses: | rest-api | Cc: |
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)
#1
@rmccue
3 months ago
- Keywords commit added
- Milestone changed from Awaiting Review to 4.9.2
- Version changed from trunk to 4.7
#2
@rachelbaker
2 months ago
- Owner set to rachelbaker
- Resolution set to fixed
- Status changed from new to closed
#3
@rachelbaker
2 months ago
In 42422:
#4
@rachelbaker
2 months ago
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening because I missed committing the unit test changes needed here.
#5
@rachelbaker
2 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In 42423:
#6
@rachelbaker
2 months ago
In 42427:
Note: See
TracTickets for help on using
tickets.
In 42421: