Skip to content

Commit 85094e5

Browse files
committed
Update GET request comment
1 parent 91fce0d commit 85094e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

wp-includes/rest-api/auth/class-wp-rest-token.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,13 @@ public function require_token() {
374374
$require_token = false;
375375
}
376376

377-
// GET requests do not require authentication, but if
378-
// the Authorization header is provided, requests should
379-
// be performed as the user corresponding to that token.
377+
/**
378+
* GET requests do not typically require authentication, but if the
379+
* Authorization header is provided, we will use it. WHat's happening
380+
* here is that `WP_REST_Token::get_auth_header` returns the bearer
381+
* token or a `WP_Error`. So if we have an error then we can safely skip
382+
* the GET request.
383+
*/
380384
if ( 'GET' === $request_method && is_wp_error( $this->get_auth_header() ) ) {
381385
$require_token = false;
382386
}

0 commit comments

Comments
 (0)