lisaogren / axios-cache-adapter

Caching adapter for axios. Store request results in a configurable store to prevent unneeded network requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support If-None-Match or/and If-modified-since

jahead opened this issue · comments

Hey,

was wondering if it is possible, to use what we have to implement a pass-though cache, that can inject the If-None-Match from etag or if-modified-since into the request header?

Basically the idea would be to have.

1st request -> response -> store cache + (etag|mtime) -> 2nd request -> inject If-None-Match|if-modified-since into cache -> if response is 304 Not Modified serve cache if not serve from cache

I was looking at how it could be modified to include this functionality, I was thinking it could be pretty simple.

We would need yet another flag :(, but we would just have to teach the request function in getting the etag | mtime out of the serialized config in the store, injecting it into http request headers, and having the response function read from the cache store if it gets a 304 Not Modified from the server