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

API request body is not passed to middleware when middleware is registered with router.use #33

Open
Byunk opened this issue Feb 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Byunk
Copy link
Collaborator

Byunk commented Feb 7, 2024

Undefined is passed to middleware when the middleware is registered with router.use.

The error case:

router.use(wrapAsync(validateOrganization));
router.get(
        '/:organization_id/:year/:half',
        wrapAsync(async (req: Request, res: Response, next: NextFunction) => {
...
}

It is resolved if:

router.get(
        '/:organization_id/:year/:half',
        wrapAsync(validateOrganization),
        wrapAsync(async (req: Request, res: Response, next: NextFunction) => {
...
}
@Byunk Byunk added the bug Something isn't working label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants