From 3b986d8b5a568444ae128c8d3a0c51a0a4777e46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lucas=20Garc=C3=ADa?= <lucas@codeccoop.org>
Date: Fri, 12 Jul 2024 00:23:39 +0200
Subject: [PATCH] fix: http response as array

---
 includes/class-http-client.php | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/includes/class-http-client.php b/includes/class-http-client.php
index 23a9275..d407231 100644
--- a/includes/class-http-client.php
+++ b/includes/class-http-client.php
@@ -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'),
-- 
GitLab