Skip to content

Why are the url parameters to an api parsed correctly by this lib but not by others? #519

Answered by Xunnamius
riha asked this question in Q&A
Discussion options

You must be logged in to vote

Your instincts are correct that Next.js is invoking some dynamic parameter parsing "middleware" somewhere else that is not invoked when just running the API resolver function in isolation, and certainly not when emulating Next.js routing via a request testing library (supertest, node-mocks-http, etc). In fact, Next.js's API resolver function uses dependency injection to get its URL parameters object, which NTARH takes full advantage of to inject the params object during testing. This is why setting params in NTARH just works 🙂.

This answer might shed more light on things too.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by riha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants