I am looking at a Caching library that is trying to use the If-Modified-Since
header of a request object. The problem is this header never gets set, it is always blank which makes sense to me seeing how it is a REQUEST.
How can you force a request to have a If-Modified-Since
header? Or am I way off for what this does.
Here is the function I am referring to.
public function isNotModified(Request $request)
{
$lastModified = $request->headers->get('If-Modified-Since');
$notModified = false;
if ($etags = $request->getEtags()) {
$notModified = (in_array($this->getEtag(), $etags) || in_array('*', $etags)) && (!$lastModified || $this->headers->get('Last-Modified') == $lastModified);
} elseif ($lastModified) {
$notModified = $lastModified == $this->headers->get('Last-Modified');
}
if ($notModified) {
$this->setNotModified();
}
return $notModified;
}