Skip to content

Commit d21b74d

Browse files
authored
Merge pull request #1863 from hbhalodia/fix/issue-1860
Update URL Metric storage REST API endpoint to return status code `423 Locked` instead of `403 Forbidden`
2 parents cb79463 + 647c173 commit d21b74d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plugins/optimization-detective/storage/rest-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function od_register_endpoint(): void {
102102
return new WP_Error(
103103
'url_metric_storage_locked',
104104
__( 'URL Metric storage is presently locked for the current IP.', 'optimization-detective' ),
105-
array( 'status' => 403 ) // TODO: Consider 423 Locked status code.
105+
array( 'status' => 423 )
106106
);
107107
}
108108
return true;

plugins/optimization-detective/tests/storage/test-rest-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ public function test_rest_request_locked(): void {
635635
$request = $this->create_request( $this->get_valid_params() );
636636

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

0 commit comments

Comments
 (0)