From 83034bec199ed1de56cde916d8787ec63f5ea5c4 Mon Sep 17 00:00:00 2001 From: Aaron McConnell Date: Fri, 2 May 2025 10:08:30 -0400 Subject: [PATCH] Handle empty parameters in POST call better PHP is encoding the empty parameters as an empty JSON list rather than the empty JSON object we need. Explicitly test for empty parameters. --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index d3bd0ba..6f556c2 100644 --- a/src/Client.php +++ b/src/Client.php @@ -214,7 +214,7 @@ public function apiCall($method, $path, $params, $additional_headers = []) $headers = []; if (in_array($method, ["POST", "PUT", "PATCH"], true)) { ksort($params); - $body = json_encode($params); + $body = empty($params) ? "{}" : json_encode($params); $params = []; $headers["Content-Type"] = "application/json"; $uri = $path;