Navigation Menu

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

Invalid example of middleware toggle usage #96

Closed
josalmi opened this issue Aug 2, 2017 · 4 comments
Closed

Invalid example of middleware toggle usage #96

josalmi opened this issue Aug 2, 2017 · 4 comments

Comments

@josalmi
Copy link

josalmi commented Aug 2, 2017

The readme contains an example Middleware toggle usage here: https://github.com/kwhitley/apicache#use-with-middleware-toggle-for-fine-control

However, in reality toggle middleware is executed before request is passed to the next middleware (See: apicache.js#L282, therefore status code will always be 200 while executing the toggle middleware in both of the endpoint listed in example. Status codes include options should be used instead for caching 200 responses only.

The toggle middleware functionality might be working as intended in which case the example is wrong or this could be a bug and the example should be working.

@kwhitley
Copy link
Owner

kwhitley commented Aug 9, 2017

I'll look into this @josalmi - if nothing else, this is definitely something to add to a future release (pre/post route passes for caching)... will try and see if I can work something in the existing [dated] architecture in the meantime...

@kitce
Copy link

kitce commented Aug 27, 2017

I am having the same issue.

Will it be fixed in the next version?

@kwhitley
Copy link
Owner

kwhitley commented Sep 8, 2017

I'm working on a fix now! Should be going out in 0.11.1 tonight/tomorrow

@kwhitley
Copy link
Owner

kwhitley commented Sep 8, 2017

@josalmi @kitce @huhuime
Fixed in apicache v0.11.1 (releasing to NPM tonight)

Thanks for bringing it to our attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants