Make WordPress Core

Opened 3 months ago

#60658 new enhancement

Set http_build_query as an option to Curl class

Reported by: elzix's profile elzix Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4.3
Component: HTTP API Keywords:
Focuses: Cc:


I had a problem integrating an API, as explained in this Stack Overflow question.

I was requesting that an option (e.g. 'query_body' => true by default) be added to $args in class WP_Http. The option would affect class Curl under function setup_handle where $data = http_build_query($data, '', '&');

It would then look like (or similar):

class-wp-http.php (line 206):

                        'body'                => null,
                        'query_body'          => true,
                        'compress'            => false,

class-wp-http.php (line 322):

                $options = array(
                        'query_body' => $parsed_args['query_body'],
                        'timeout'    => $parsed_args['timeout'],

Curl.php (line 393):

                        } elseif (!is_string($data)) {
                                $data = $options['query_body'] ? http_build_query($data, '', '&') : $data;

When I make these changes to my copy of WordPress, the API works and it does not affect the rest of the core.

Change History (0)

Note: See TracTickets for help on using tickets.