You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My plugin uses wp_remote_post with a Content-Type: application/json header (see below for code sample). While it works fine in regular WordPress installs, when this code runs in Playground, the Content-Type header is not respected, and instead gets sent as application/x-www-form-urlencoded. This causes my wp_remote_post() call to fail since the server returns an error.
Example of wp_remote_post() call with content-type header:
$response = wp_remote_post(
$this->base_url . '/images',
array(
'headers' => array(
'Content-Type' => 'application/json', /* THIS IS NOT BEING RESPECTED by Playground */
'X-Api-Key' => $this->api_key
),
'body' => wp_json_encode( $body )
)
);
I confirmed this same exact request to the server endpoint with the proper content-type header works as expected.
The Chrome network tab confirms playground is sending Content-Type: application/x-www-form-urlencoded:
My plugin uses
wp_remote_post
with aContent-Type: application/json
header (see below for code sample). While it works fine in regular WordPress installs, when this code runs in Playground, the Content-Type header is not respected, and instead gets sent asapplication/x-www-form-urlencoded
. This causes my wp_remote_post() call to fail since the server returns an error.Example of wp_remote_post() call with content-type header:
I confirmed this same exact request to the server endpoint with the proper content-type header works as expected.
The Chrome network tab confirms playground is sending Content-Type:
application/x-www-form-urlencoded
:My blueprint file DOES include networking, etc:
Any ideas if it is possible to fix this?
The text was updated successfully, but these errors were encountered: