You are here

public function HtmlResponse::__construct in Drupal 9

Constructs a HtmlResponse object.

Parameters

array|string $content: The response content, see setContent().

int $status: The response status code.

array $headers: An array of response headers.

Throws

\InvalidArgumentException When the HTTP status code is not valid.

1 call to HtmlResponse::__construct()
BigPipeResponse::__construct in core/modules/big_pipe/src/Render/BigPipeResponse.php
Constructs a new BigPipeResponse.
1 method overrides HtmlResponse::__construct()
BigPipeResponse::__construct in core/modules/big_pipe/src/Render/BigPipeResponse.php
Constructs a new BigPipeResponse.

File

core/lib/Drupal/Core/Render/HtmlResponse.php, line 41

Class

HtmlResponse
Response that contains and can expose cacheability metadata and attachments.

Namespace

Drupal\Core\Render

Code

public function __construct($content = '', int $status = 200, array $headers = []) {
  parent::__construct('', $status, $headers);
  $this
    ->setContent($content);
}