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

node-mocks-http doesn't work with NextJS requests #280

Closed
mhaligowski opened this issue Nov 9, 2023 · 2 comments
Closed

node-mocks-http doesn't work with NextJS requests #280

mhaligowski opened this issue Nov 9, 2023 · 2 comments

Comments

@mhaligowski
Copy link
Contributor

I'm trying to use node-mocks-http with NextJS API endpoint.

const mockRequest = httpMocks.createRequest({...}) as NextApiRequest;

This works fine fine until some other library (@opentelemetry/auto-instrumentation-node) brought in @types/express into my node_modules. At this point the code became unusable until I do as undefined as NextApiRequest.

The node-mocks-https is expected to mock the NodeJS HTTP requests, i.e. http.IncomingMessage, and not express.Request.

@eugef
Copy link
Owner

eugef commented Nov 10, 2023

Hi @mhaligowski, do you have any suggestions/ideas on how to fix this?

@mhaligowski
Copy link
Contributor Author

How about this? #281

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

2 participants