Skip to content

Commit

Permalink
Merge pull request #855 from libgraviton/feature/no-etag
Browse files Browse the repository at this point in the history
flex etag
  • Loading branch information
narcoticfresh committed Feb 21, 2024
2 parents 0e21b00 + 82d5507 commit 411e05c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"squizlabs/php_codesniffer": "~3",

"graviton/test-services-bundle": "^2.15.0",
"graviton/mongodb-fixtures-bundle": "dev-develop",
"graviton/mongodb-fixtures-bundle": "^4.0.1",
"libgraviton/codesniffer": "~2",

"symfony/phpunit-bridge": "^6.0",
Expand Down
22 changes: 10 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Graviton/CacheBundle/Listener/ETagResponseListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Graviton\CacheBundle\Listener;

use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Event\ResponseEvent;

/**
Expand All @@ -27,6 +28,10 @@ public function onKernelResponse(ResponseEvent $event)
{
$response = $event->getResponse();

if ($response instanceof StreamedResponse || empty($response->getContent())) {
return;
}

/**
* the "W/" prefix is necessary to qualify it as a "weak" Etag.
* only then a proxy like nginx will leave the tag alone because a strong cannot
Expand Down

0 comments on commit 411e05c

Please sign in to comment.