Skip to content

Add support for ETag and Last-Modified headers #332

@JWCook

Description

@JWCook

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions