title: Understand Etags HTTP Header
body: <p>I am using a caching library that has the function seen below. It is attempting to grab eTags from the Request on the 5th line but the eTags are never set.</p>
  
  <p>When would a REQUEST have eTags? and how might you set them?</p>
  
  <p>Thanks.</p>
  
  <pre><code>public function isNotModified(Request $request)
  {
      $lastModified = $request-&gt;headers-&gt;get('If-Modified-Since');
  
      $notModified = false;
      if ($etags = $request-&gt;getEtags()) {
          $notModified = (in_array($this-&gt;getEtag(), $etags) || in_array('*', $etags)) &amp;&amp; (!$lastModified || $this-&gt;headers-&gt;get('Last-Modified') == $lastModified);
      } elseif ($lastModified) {
          $notModified = $lastModified == $this-&gt;headers-&gt;get('Last-Modified');
      }
  
      if ($notModified) {
          $this-&gt;setNotModified();
      }
  
      return $notModified;
  }
  </code></pre>