← All changes
|
src/services/suggestions-api/endpoints/class-endpoint-check-auth.php
+8
-1
3.24.1
→
3.24.2
View file →
| @@ -52,8 +52,9 @@ | ||
| 52 | 52 | /** |
| 53 | 53 | * Sends a request to the remote API. |
| 54 | 54 | * |
| 55 | 55 | * @since 3.19.0 |
| 56 | + * @since 3.24.2 Strips the credentials from errors. | |
| 56 | 57 | * |
| 57 | 58 | * @param string $method The HTTP method to use for the request. |
| 58 | 59 | * @param array<mixed> $query_args The query arguments to send to the remote API. |
| 59 | 60 | * @param array<mixed> $data The data to send in the request body. |
| @@ -70,9 +71,15 @@ | ||
| 70 | 71 | |
| 71 | 72 | /** @var WP_HTTP_Response|WP_Error $response */ |
| 72 | 73 | $response = wp_safe_remote_request( $request_url, $request_options ); |
| 73 | 74 | |
| 74 | - return $this->process_response( $response ); | |
| 75 | + if ( is_wp_error( $response ) ) { | |
| 76 | + return $this->get_relayable_transport_error( $response ); | |
| 77 | + } | |
| 78 | + | |
| 79 | + $result = $this->process_response( $response ); | |
| 80 | + | |
| 81 | + return is_wp_error( $result ) ? $this->strip_credentials_from_error( $result ) : $result; | |
| 75 | 82 | } |
| 76 | 83 | |
| 77 | 84 | /** |
| 78 | 85 | * Processes the response from the remote API. |