Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update URL Metric storage REST API endpoint to return status code 423 Locked instead of 403 Forbidden #1863

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading