<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CmsBundle\Exception;

use Contao\CoreBundle\Exception\ResponseException;
use Symfony\Component\HttpFoundation\Response;

class TurboStreamResponseException extends ResponseException
{
    public function __construct(Response $response, ?\Exception $previous = null)
    {
        if (!$response->headers->has('Content-Type')) {
            $response->headers->set('Content-Type', 'text/vnd.turbo-stream.html');
        }

        parent::__construct($response, $previous);
    }
}
