function StreamedJsonResponse::__construct
Parameters
mixed[] $data JSON Data containing PHP generators which will be streamed as list of data or a Generator:
int $status The HTTP status code (200 "OK" by default):
array<string, string|string[]> $headers An array of HTTP headers:
int $encodingOptions Flags for the json_encode() function:
Overrides StreamedResponse::__construct
File
-
vendor/
symfony/ http-foundation/ StreamedJsonResponse.php, line 55
Class
- StreamedJsonResponse
- StreamedJsonResponse represents a streamed HTTP response for JSON.
Namespace
Symfony\Component\HttpFoundationCode
public function __construct(iterable $data, int $status = 200, array $headers = [], int $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS) {
parent::__construct($this->stream(...), $status, $headers);
if (!$this->headers
->get('Content-Type')) {
$this->headers
->set('Content-Type', 'application/json');
}
}