-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Requests that error remain in cache and cannot be cleared #9
Comments
Sure, do you want to create a PR? |
Yeah I’m working on on one at the moment. I will submit shortly.
… On 29 Apr 2020, at 3:17 pm, Netanel Basal ***@***.***> wrote:
Sure, do you want to create a PR?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
jmannau
added a commit
to jmannau/cashew
that referenced
this issue
Apr 29, 2020
3 tasks
I have opened a PR #10 to fix this. I hope it is acceptable. Thanks for your work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm submitting a...
Current behavior
If an http request errors (any 400/500 response), the request remains in the queue and cannot be cleared but emptying the cache.
Expected behavior
And non successful response should not be cached and should be cleared from the queue.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
For instance, when requesting an endpoint that is protected by authorisation, the first user may not be able to access the resource (returning 403). This user logs out and another user logs in. The request is retried, but the original request is issued including the Authorization header from user 1, not the new request with the new Authorization header.
Suggested Fix
I suggest changing the interceptor like this (https://github.com/ngneat/cashew/blob/master/projects/ngneat/cashew/src/lib/httpCacheInterceptor.ts#L37):
Environment
The text was updated successfully, but these errors were encountered: