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

If a previous middleware has changed the page or limit to Numbers, then their values are overwritten with defaults. #57

Open
adam-s64 opened this issue Sep 2, 2024 · 0 comments
Labels

Comments

@adam-s64
Copy link

adam-s64 commented Sep 2, 2024

This behavior was seen with version 1.0.2.

In this case, the user of the library had included express-paginate middleware twice by mistake (once at the top level and once again on the specific route). However, this problem will occur when used with any other middleware that changes the type of the page or limit away from String.

This is the relevant code in the index.js

    req.query.page = (typeof req.query.page === 'string') ? parseInt(req.query.page, 10) || 1 : 1;

    req.query.limit = (typeof req.query.limit === 'string') ? parseInt(req.query.limit, 10) || 0 : _limit;
@adam-s64 adam-s64 added the bug label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant