Skip to content

Commit 154d349

Browse files
committed
Update Response::negotiateEtag method
1 parent 7a44329 commit 154d349

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Response.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,7 @@ protected function sendHeaders() : void
521521
$this->setDate();
522522
}
523523
$this->negotiateContentType();
524-
if ($this->isAutoEtag() && !$this->hasDownload()) {
525-
$this->negotiateEtag();
526-
}
524+
$this->negotiateEtag();
527525
$this->negotiateCsp();
528526
\header($this->getStartLine());
529527
$replace = $this->isReplacingHeaders();
@@ -619,6 +617,11 @@ protected function negotiateContentType() : void
619617
}
620618

621619
/**
620+
* Negotiate the ETag header.
621+
*
622+
* It does nothing if {@see Framework\HTTP\Response::isAutoEtag()} is false
623+
* or {@see Framework\HTTP\ResponseDownload::hasDownload()} is true.
624+
*
622625
* Set the ETag header, based on the Response body, and start the
623626
* negotiation.
624627
*
@@ -634,6 +637,9 @@ protected function negotiateContentType() : void
634637
*/
635638
protected function negotiateEtag() : void
636639
{
640+
if (!$this->isAutoEtag() || $this->hasDownload()) {
641+
return;
642+
}
637643
// Content-Length is required by Firefox,
638644
// otherwise it does not send the If-None-Match header
639645
$this->setContentLength();

0 commit comments

Comments
 (0)