WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#38205 closed defect (bug) (duplicate)

Lack of actions/filters to access Requests library hooks

Reported by: reidbusi Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: HTTP API Keywords:
Focuses: Cc:

Description

I am unable to register hooks to the Requests library in the WordPress 4.6.x HTTP API context.

I refer you to: https://github.com/rmccue/Requests/issues/233 ( see later comments where I realise that Requests hooks must be passed to Requests functions when called )

WP 4.6.1 wp-includes\class-http.php line 303:

                $options = array(
                        'timeout' => $r['timeout'],
                        'useragent' => $r['user-agent'],
                        'blocking' => $r['blocking'],
                        'hooks' => new Requests_Hooks(),
                );

Not quite sure what the right fix here is. Possibly naming the Requests_Hooks object and providing an action where it can be modified? I will test such a modification of the core and post my results here...

(It is worth noting here that the relatively new WooCommerce Square extension has recently abandoned the WP HTTP API and is manually building and executing PHP cURL requests, presumably due to this new inadequacy of WP's HTTP API)

Change History (1)

#1 @ocean90
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from 4.6.1 to 4.6

Hello @reidbusi,

we're already tracking this issue in #37843. Can you help to test this proposed patch? Some feedback on the ticket would be great. Thanks!

Note: See TracTickets for help on using tickets.