Skip to content

Commit

Permalink
Merge pull request #1863 from hbhalodia/fix/issue-1860
Browse files Browse the repository at this point in the history
Update URL Metric storage REST API endpoint to return status code `423 Locked` instead of `403 Forbidden`
  • Loading branch information
westonruter authored Feb 11, 2025
2 parents cb79463 + 647c173 commit d21b74d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/optimization-detective/storage/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function od_register_endpoint(): void {
return new WP_Error(
'url_metric_storage_locked',
__( 'URL Metric storage is presently locked for the current IP.', 'optimization-detective' ),
array( 'status' => 403 ) // TODO: Consider 423 Locked status code.
array( 'status' => 423 )
);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ public function test_rest_request_locked(): void {
$request = $this->create_request( $this->get_valid_params() );

$response = rest_get_server()->dispatch( $request );
$this->assertSame( 403, $response->get_status() );
$this->assertSame( 423, $response->get_status() );
$this->assertSame( 'url_metric_storage_locked', $response->get_data()['code'] );
}

Expand Down

0 comments on commit d21b74d

Please sign in to comment.