From 5a430b7dde7a3991ab38f6ca15d5b8c4b0768654 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 06:43:25 +0000 Subject: [PATCH 1/2] Initial plan From 632486c1db50191d6be2409a2e8f87257e4bfa3f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 06:50:49 +0000 Subject: [PATCH 2/2] Address PR feedback: Import Swoole\Coroutine\run and fix GraphQL handling Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com> --- src/Adapter/Swoole.php | 5 +++-- src/Client.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Adapter/Swoole.php b/src/Adapter/Swoole.php index 11b4dae..3df1c6b 100644 --- a/src/Adapter/Swoole.php +++ b/src/Adapter/Swoole.php @@ -15,6 +15,8 @@ use Utopia\Fetch\Options\Swoole as SwooleOptions; use Utopia\Fetch\Response; +use function Swoole\Coroutine\run; + /** * Swoole Adapter * HTTP adapter using Swoole's HTTP client @@ -365,8 +367,7 @@ public function send( $response = null; $exception = null; - $coRun = 'Swoole\\Coroutine\\run'; - $coRun(function () use ($url, $method, $body, $headers, $options, $chunkCallback, &$response, &$exception) { + run(function () use ($url, $method, $body, $headers, $options, $chunkCallback, &$response, &$exception) { try { $response = $this->executeRequest($url, $method, $body, $headers, $options, $chunkCallback); } catch (Throwable $e) { diff --git a/src/Client.php b/src/Client.php index 67996b8..50ac37a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -297,7 +297,7 @@ public function fetch( $body = match ($this->headers['content-type']) { self::CONTENT_TYPE_APPLICATION_JSON => $this->jsonEncode($body), self::CONTENT_TYPE_APPLICATION_FORM_URLENCODED, self::CONTENT_TYPE_MULTIPART_FORM_DATA => self::flatten($body), - self::CONTENT_TYPE_GRAPHQL => isset($body['query']) && is_string($body['query']) ? $body['query'] : throw new Exception('GraphQL body must contain a "query" field with a string value'), + self::CONTENT_TYPE_GRAPHQL => isset($body['query']) && is_string($body['query']) ? $body['query'] : $this->jsonEncode($body), default => $body, }; }