Skip to content

Commit

Permalink
HTTP API: Update wp_http_supports() to use Requests.
Browse files Browse the repository at this point in the history
Update the capabilities check in `wp_http_supports` to use `WpOrg\Requests\Requests::has_capabilities` rather than the deprecated `WP_HTTP::_get_first_available_transport()`.

Props dd32, mukesh27, costdev, desrosj, johnbillion, jorbin, jrf, chaion07.
Fixes #37708.


git-svn-id: https://develop.svn.wordpress.org/trunk@58934 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
peterwilsoncc committed Aug 25, 2024
1 parent 717ee4e commit 24e8775
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/wp-includes/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,6 @@ function wp_remote_retrieve_cookie_value( $response, $name ) {
* @return bool
*/
function wp_http_supports( $capabilities = array(), $url = null ) {
$http = _wp_http_get_object();

$capabilities = wp_parse_args( $capabilities );

$count = count( $capabilities );
Expand All @@ -407,7 +405,7 @@ function wp_http_supports( $capabilities = array(), $url = null ) {
}
}

return (bool) $http->_get_first_available_transport( $capabilities );
return WpOrg\Requests\Requests::has_capabilities( $capabilities );
}

/**
Expand Down

0 comments on commit 24e8775

Please sign in to comment.