JsonFileResponse
A JSON PSR-7 response implementation.
Allows creating a response by passing a file URI to the constructor; by default, loads the data from the file as the body (assumes the file already contains serialized JSON), sets a status code of 200 and sets the Content-Type header to application/json.
- Full name:
\Drupal\helper\Response\JsonFileResponse - Parent class:
Response
Methods
__construct
{@inheritdoc}
public __construct(string $uri, int $status = 200, array $headers = [], mixed $version = '1.1', bool $reason = null): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$uri |
string | |
| The URI containing an encoded JSON string. | ||
$status |
int | |
| The status. | ||
$headers |
array | |
| The headers. | ||
$version |
mixed | |
| The version. | ||
$reason |
bool | |
| The reason. |