Skip to content

Commit

Permalink
Add devmode
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Feb 28, 2024
1 parent cda074e commit 6b7ee19
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/web/ResponseBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Craft;
use craft\cloud\fs\TmpFs;
use craft\cloud\HeaderEnum;
use craft\cloud\Module;
use craft\web\Response;
use Illuminate\Support\Collection;
use yii\base\Behavior;
Expand Down Expand Up @@ -40,6 +42,7 @@ public function gzip(): void

public function afterPrepare(Event $event): void
{
$this->addDevModeHeader();
$this->joinMultiValueHeaders();
$this->gzip();
$this->serveBinaryFromS3();
Expand Down Expand Up @@ -111,4 +114,11 @@ protected function joinHeaderValues(string $name, array $values, string $glue):

return $value;
}

protected function addDevModeHeader(): void
{
if (Module::getInstance()->getConfig()->getDevMode()) {
$this->owner->getHeaders()->set(HeaderEnum::DEV_MODE->value, '1');
}
}
}

0 comments on commit 6b7ee19

Please sign in to comment.