Skip to content

Commit

Permalink
Allow for binary responses
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Sep 23, 2022
1 parent facd317 commit c7958c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Http/Commands/SendWebResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
}
Expand All @@ -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,
Expand Down

0 comments on commit c7958c6

Please sign in to comment.