WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#39166 closed defect (bug) (duplicate)

REST API and PHP HTTPClient wrapper error: Invalid JSON body passed

Reported by: peterigz Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords:
Focuses: rest-api Cc:
PR Number:

Description

Since 4.7 I can no longer do a request with the php wrapper (https://github.com/woocommerce/wc-api-php), so doing:

$order = $client->get('orders/'.$order_id);

I get the error "Error: Invalid JSON body passed". The body being passed is of course blank because there's no data needed for a get request. I guess the issue is in class-wp-rest-request::parse_json_params?

I can work around forcing a value in the data parameter in Client->Get but obviously not ideal :)

Change History (1)

#1 @jnylen0
3 years ago

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

Closing as a duplicate of #39150. Thanks for reporting, @peterigz - let's take a closer look over there.

Note: See TracTickets for help on using tickets.