Sets the ETag value.
@api
string|null $etag The ETag unique identifier or null to remove the header:
Boolean $weak Whether you want a weak ETag or not:
public function setEtag($etag = null, $weak = false) {
if (null === $etag) {
$this->headers
->remove('Etag');
}
else {
if (0 !== strpos($etag, '"')) {
$etag = '"' . $etag . '"';
}
$this->headers
->set('ETag', (true === $weak ? 'W/' : '') . $etag);
}
return $this;
}