diff --git a/src/web/ResponseEventHandler.php b/src/web/ResponseEventHandler.php index d6febca..4aae724 100644 --- a/src/web/ResponseEventHandler.php +++ b/src/web/ResponseEventHandler.php @@ -12,11 +12,10 @@ use yii\web\Response as YiiResponse; use yii\web\ServerErrorHttpException; -/** - * @property Response $response - */ class ResponseEventHandler { + protected Response $response; + public function __construct() { $this->response = Craft::$app->getResponse(); @@ -38,7 +37,7 @@ public function gzip(): void Craft::$app->getRequest()->getHeaders()->get('Accept-Encoding') ?? '' ); - if (Collection::make($accepts)->doesntContain('gzip')) { + if (Collection::make($accepts)->doesntContain('gzip') || $this->response->content === null) { return; }