You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that this package is not compatible with Next's newer "app" router. The older "page" router works fine because its NextApiRequest extends IncomingMessage as your package requires. However, the "app" router's NextRequest does not -- it extends the standard Request interface of the fetch API.
Is this a known issue? Am I missing something obvious? It took awhile today to sort all this out. If it's correct, it would be helpful to others to have a note on the README.md.
By the way, I think you have a typo in your README.md that refers to http.IncomingRequest, but it should say http.IncomingMessage
The text was updated successfully, but these errors were encountered:
I'm not sure what we're getting out of mocking the request since we're just passing it into the handler anyways. Might as well just create the request object. This worked for me (just creating the NextRequest object, not mocking anything)
I tried to circunvent this problem as @DaneSharafinski said, but i have a problems when uploading binary files, because the NextRequest constructor automatically tries to parse the body to uint8Array, also tried with the usual request constructor but to no avail.
I also tried manually testing the binary upload outside jest with postman, and works fine
maybe its a next14 thing?
It seems that this package is not compatible with Next's newer "app" router. The older "page" router works fine because its NextApiRequest extends IncomingMessage as your package requires. However, the "app" router's NextRequest does not -- it extends the standard Request interface of the fetch API.
Is this a known issue? Am I missing something obvious? It took awhile today to sort all this out. If it's correct, it would be helpful to others to have a note on the README.md.
By the way, I think you have a typo in your README.md that refers to http.IncomingRequest, but it should say http.IncomingMessage
The text was updated successfully, but these errors were encountered: