Skip to content

Commit dc185be

Browse files
committed
collapse
1 parent f9efd80 commit dc185be

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

src/Appwrite/GraphQL/Resolvers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private static function resolve(
378378
$container->set('request', static fn () => $request);
379379
$container->set('response', static fn () => $resolverResponse);
380380
$resolverResponse->setContentType(Response::CONTENT_TYPE_NULL);
381-
$resolverResponse->clearSent();
381+
$resolverResponse->setSent(false);
382382

383383
$route = $utopia->match($request, fresh: true);
384384
$request->setRoute($route);
@@ -390,7 +390,7 @@ private static function resolve(
390390
if ($resolverResponse->isSent()) {
391391
$response
392392
->setStatusCode($resolverResponse->getStatusCode())
393-
->markSent();
393+
->setSent(true);
394394

395395
$resolve(null);
396396
return;

src/Appwrite/Utopia/Response.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -629,23 +629,12 @@ public function getPayload(): array
629629
}
630630

631631
/**
632-
* Reset the sent flag so the response can be reused for another
633-
* action execution (e.g. batched GraphQL queries that share one
634-
* Response instance).
632+
* Set the sent flag on the response. Pass false to allow reuse
633+
* (e.g. batched GraphQL queries), true to prevent further writes.
635634
*/
636-
public function clearSent(): static
635+
public function setSent(bool $sent): static
637636
{
638-
$this->sent = false;
639-
return $this;
640-
}
641-
642-
/**
643-
* Mark the response as already sent so later callers do not attempt to
644-
* write a second payload to the same underlying Swoole response.
645-
*/
646-
public function markSent(): static
647-
{
648-
$this->sent = true;
637+
$this->sent = $sent;
649638
return $this;
650639
}
651640

0 commit comments

Comments
 (0)