15 Commits

Author SHA1 Message Date
Arthur Fiorette
ed99d775bb
feat: correct ESM and CJS support, move to microbundle. (#764) 2024-01-18 23:48:33 -03:00
Arthur Fiorette
ecbc27e466
style: linted code 2023-11-16 03:26:37 -03:00
arthurfiorette
2cc948d531
feat: moved tests to node:test (#628) 2023-09-03 15:53:58 -03:00
arthurfiorette
683dbe0f22
fix: support max-stale on header interpreter (#543) 2023-06-09 13:10:06 -03:00
Richard Garnier
2ae4d28878
fix: Support stale-while-revalidate (#514)
* implement stale-while-revalidate

* Backward compatibility

* Fix review comments

* chore: isExpired check comment

---------

Co-authored-by: Arthur Fiorette <github@arthur.place>
2023-03-19 16:54:24 -03:00
arthurfiorette
d14750ee63
refactor: moved header file 2022-01-19 07:48:33 -03:00
arthurfiorette
4f938a4793
tests: splited header interpreter tests into multiple files 2022-01-08 12:26:37 -03:00
Arthur Fiorette
25b34e5d11
docs: documentation at axios-cache-interceptor.js.org (#108) 2022-01-06 18:44:36 -03:00
arthurfiorette
fec63a84a7
test: added one simple test 2021-12-27 09:05:53 -03:00
Arthur Fiorette
48e33c5d5a
feat: etag and if-modified-since support (#53)
* feat(WIP): etag and if-modified-since support

* test: fixed test name

* fix: merge response headers

* test: add etag / last-modified tests

* test: add must-revalidate tests

* fix: handle expirationTime 0 as true.

* tests: refactored some tests

* test: added keepIfStale tests

* fix: remove axios error for 304 requests

* fix: possible infinite loop on validateStatus function

* tests: ignore code that is hard test from coverage

* fix: use Last-Modified header for modifiedSince

If-Modified-Since is never sent by a server, it's
a client only header. However Last-Modified is sent
by the server to indicate the last time the returned
version was modified (it might not be the last version
depending on cache configuration on intermediate
servers)

* test: use validateStatus in mock

This more closely match default axios adapter.

* fix: validateStatus handling all cases

* refactor: use cache.createdAt if the last-modified header isn't present

* test: etag with predefined value

* test: added more test cases

* fix: fixed logic in some tests

* docs: initial documentation

* fix: manual values work out of the box

This removes header requirement from server.

* docs: add details to etag and modifiedSince features

* fix: delete custom headers from response

* feat: accept all configurations from global axios

Merging global into local configuration enable user
to use global configuration for all options and remove
the need to check local and global values every time.

* fix: preserve original types from AxiosInstance

The only value axios needs is a URL, and in the second definition of the method, there is already a URL parameter, so it can be undefined.

* Fix: defaults modifiedSince back to false.

Avoids breaking changes.

* docs: fix etag examples

* docs: document internal headers

* refactor: ternary operator :)

* style: prettified code

* test: remove modifiedSince: false in tests since this is the default

* docs: fix headers examples

* docs: fixed example formatting

* tests: split tests into multiple files to test them faster

* docs: correct jsdoc empty object

Co-authored-by: Charly Koza <cka@f4-group.com>
2021-11-15 10:43:20 -03:00
Hazork
76a8af7433 feat: immutable cache support 2021-11-11 14:26:27 -03:00
Arthur Fiorette
92b9ed7abf
feat: more headers supports, tests and must-revalidate fix (#51)
* feat: must-revalidate and headers enum
* test: added more tests
* test: test and code fixes
* test: more tests
2021-11-11 14:16:37 -03:00
Hazork
33b8dcd58b refactor!: updated all exports 2021-09-21 12:01:47 -03:00
Hazork
6075a0a960 fix: a bunch of tests 2021-09-19 19:29:05 -03:00
Hazork
288c11849c feat: interpreter also handles Expires header (and tests) 2021-09-13 17:46:26 -03:00