Skip to content
This repository was archived by the owner on Aug 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Adapter/Swoole.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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,
};
}
Expand Down