Skip to content

Commit

Permalink
Filter Requests library to use the Fetch handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
dd32 authored Feb 23, 2024
1 parent 1467766 commit 873bcb2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ function networking_disabled() {
$transports[] = 'Fetch';
return $transports;
});

/**
* Force the Fetch transport to be used in Requests.
* The 'http_api_transports' filter was deprecated, and is no longer actively in use.
*/
add_action( 'requests-requests.before_request', function( $url, $headers, $data, $type, &$options ) {
$options['transport'] = 'Wp_Http_Fetch';
}, 10, 5 );

/**
* Disable signature verification as it doesn't seem to work with
* fetch requests:
Expand Down

0 comments on commit 873bcb2

Please sign in to comment.