From 0cc8c68b8296a4a4c5517c774d7af2c4528534a1 Mon Sep 17 00:00:00 2001
From: Thibault Dockx <thibault.dockx@fusiondirectory.org>
Date: Tue, 25 Mar 2025 00:40:42 +0000
Subject: [PATCH] :sparkles: Feat(webservice) - enhance execution method

---
 src/FusionDirectory/Rest/WebServiceCall.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/FusionDirectory/Rest/WebServiceCall.php b/src/FusionDirectory/Rest/WebServiceCall.php
index 232e855..d035969 100644
--- a/src/FusionDirectory/Rest/WebServiceCall.php
+++ b/src/FusionDirectory/Rest/WebServiceCall.php
@@ -199,19 +199,22 @@ class WebServiceCall
     return $response;
   }
 
-  /**
+/**
  * @return array
- * @throws Exception
+ * @throws \Exception
  */
 public function execute(): array
 {
-    $this->setCurlSettings();
     $response = curl_exec($this->ch);
     $this->handleCurlError($this->ch);
     
     $decoded = json_decode($response, true);
     curl_close($this->ch);
     
+    if (!is_array($decoded)) {
+        throw new \Exception('Invalid JSON response: ' . $response);
+    }
+    
     return $decoded;
 }
 
-- 
GitLab