Skip to content
Snippets Groups Projects
Commit 3b986d8b authored by Lucas García's avatar Lucas García
Browse files

fix: http response as array

parent e96e023a
No related branches found
No related tags found
No related merge requests found
......@@ -122,19 +122,7 @@ class Http_Client
return $response;
}
$response = (object) $response;
$response->json = function () use ($response) {
if (!isset($response->headers['content-type'])) {
return null;
}
if ($response->headers['content-type'] !== 'application/json') {
return null;
}
return (array) json_decode($response->body, true);
};
if ($response->response['code'] !== 200) {
if ($response['response']['code'] !== 200) {
return new WP_Error(
'wpct_http_error',
__("Http error response status code: Request to {$url} with {$args['method']} method", 'wpct-http-bridge'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment