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

Can't use middleware toggle bypass along with regular middleware on same route #200

Open
arthurfranca opened this issue Mar 17, 2020 · 1 comment

Comments

@arthurfranca
Copy link

Bellow code will end in an endless loop - maybe because middleware toggle bypasses cache too late (won't prevent good chunk of lib code from running).

e.g.:

app
  .get('*', cache(20 minutes, req => req.path !== '/test'))
  .get('/test', cache('1 minute'))
@arthurfranca
Copy link
Author

i think it could be done if adding an early toggle option (toggle fn wouldn't have access to e.g. response headers, but would already have access to things like req.path, so could check if should bypass at start of middleware running)

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

No branches or pull requests

1 participant