Support for basic Cache-Control headers was added with #192 / #261. For more complete header support, the next logical step would be handling ETag and Last-Modified headers.
Here is an outline of how I would expect that to work:
- When a cached response is retrieved and it's expired:
- If it contains an
ETag header, add an If-None-Match header to the request
- If it contains a
Last-Modified header, add an If-Modified-Since header to the request
- If a
304 Not Modified response is received, returned the cached response
- If a new
200 response is received, update the cache and return the new response
Other related headers to consider:
If-Match
If-Unmodified-Since
If-Range
I'm unsure if/how those should be used within requests-cache, though.
If this is a feature you would like, please comment!
Support for basic
Cache-Controlheaders was added with #192 / #261. For more complete header support, the next logical step would be handlingETagandLast-Modifiedheaders.Here is an outline of how I would expect that to work:
ETagheader, add anIf-None-Matchheader to the requestLast-Modifiedheader, add anIf-Modified-Sinceheader to the request304 Not Modifiedresponse is received, returned the cached response200response is received, update the cache and return the new responseOther related headers to consider:
If-MatchIf-Unmodified-SinceIf-RangeI'm unsure if/how those should be used within requests-cache, though.
If this is a feature you would like, please comment!