Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staleIfError: true should use the stale-if-error directive if present #506

Closed
arthurfiorette opened this issue Feb 17, 2023 · 3 comments · Fixed by #508 or #509
Closed

staleIfError: true should use the stale-if-error directive if present #506

arthurfiorette opened this issue Feb 17, 2023 · 3 comments · Fixed by #508 or #509
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@arthurfiorette
Copy link
Owner

Describe the bug

When using staleIfError: true, its time is resolved as forever, but if the cache-control header included a stale-if-error directive, that time should be used instead.

To Reproduce

axios.get('url to a server that returns stale-if-error', {
  cache: { staleIfError: true }
});

// The cache will be stale forever.

Expected behavior

When staleIfError is true and the server returned the stale-if-error directive, it should behave exactly the same as staleIfError: <ms in the stale-if-error directive>

Additional context

  • Axios: v1.3.1
  • Axios Cache Interceptor: v1.0.1
@arthurfiorette arthurfiorette added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Feb 17, 2023
@arthurfiorette arthurfiorette self-assigned this Feb 17, 2023
@arthurfiorette
Copy link
Owner Author

Anyone up to working on this?

gmazoni added a commit to gmazoni/axios-cache-interceptor that referenced this issue Feb 24, 2023
@gmazoni
Copy link
Contributor

gmazoni commented Feb 24, 2023

Working on

arthurfiorette pushed a commit that referenced this issue Feb 24, 2023
@arthurfiorette
Copy link
Owner Author

Whoopsie, can you change the documentation where it was affected?

* - `boolean` -> `false` disables and `true` enables with infinite time.

and

https://github.com/arthurfiorette/axios-cache-interceptor/blob/main/docs/src/config/request-specifics.md#cachestaleiferror

arthurfiorette pushed a commit that referenced this issue Feb 24, 2023
* Fix #506

* fix fmt

* fix docs

* fix docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
2 participants