diff --git a/src/Http/Commands/SendWebResponse.php b/src/Http/Commands/SendWebResponse.php index bcb52b6..0e34d2b 100644 --- a/src/Http/Commands/SendWebResponse.php +++ b/src/Http/Commands/SendWebResponse.php @@ -15,7 +15,7 @@ public static function from(string $id, SymfonyResponse $response): self $id, $response->getStatusCode(), static::getPsrHeaders($response), - $response->getContent(), + static::getContent($response), $response->getProtocolVersion(), ); } @@ -34,6 +34,14 @@ protected static function getPsrHeaders(SymfonyResponse $response): array return $headers; } + protected static function getContent(SymfonyResponse $response): string + { + // This accounts for binary responses that are typically streamed + ob_start(); + $response->sendContent(); + return ob_get_clean(); + } + public function __construct( public string $request_id, public int $status,