arthurfiorette / axios-cache-interceptor

📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!
https://axios-cache-interceptor.js.org
MIT License
703 stars 58 forks source link

Feature: add stale flag in request return object #843

Closed MerryCello closed 3 months ago

MerryCello commented 5 months ago

This PR is an attempt to add the request response "stale" flag that is present in the axios-cache-adapter. This flag says whether or not the response is from staled cache. This would be returned along with the "cached" flag. Please let me know if there's anything that I'm missing.

arthurfiorette commented 5 months ago

please also add tests

arthurfiorette commented 5 months ago

Ci is failing

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.27%. Comparing base (a30f8d2) to head (7e432d0). Report is 7 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #843 +/- ## ========================================== + Coverage 99.26% 99.27% +0.01% ========================================== Files 19 19 Lines 2442 2479 +37 Branches 212 214 +2 ========================================== + Hits 2424 2461 +37 Misses 17 17 Partials 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MerryCello commented 5 months ago

@arthurfiorette, I added some tests and fixed the failing ones. I also added some comments as replies above that may have been missed. If you could review those, that would be great.

arthurfiorette commented 3 months ago

thanks for your work!