Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Response.php

function Response::setContentSafe

Marks a response as safe according to RFC8674.

See also

https://tools.ietf.org/html/rfc8674

File

vendor/symfony/http-foundation/Response.php, line 1289

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setContentSafe(bool $safe = true) : void {
    if ($safe) {
        $this->headers
            ->set('Preference-Applied', 'safe');
    }
    elseif ('safe' === $this->headers
        ->get('Preference-Applied')) {
        $this->headers
            ->remove('Preference-Applied');
    }
    $this->setVary('Prefer', false);
}
RSS feed
Powered by Drupal