POST request succeeds for pages with next dev
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.14.0
npm: 8.12.0
Yarn: 1.22.17
pnpm: 7.5.2
Relevant packages:
next: 12.2.3-canary.15
eslint-config-next: 12.2.2
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
When you send a POST request to a page running with next dev, it succeeds with 200 status even though it fails with 405 status when running with next start
Expected Behavior
Non-GET/HEAD requests fail with 405 status code in the same way with next start
Link to reproduction
https://github.com/vercel/next.js/tree/canary/examples
To Reproduce
$ next dev
# on another terminal
$ curl http://localhost:3000 -X POST -v
The problem should happen on any apps.
Does someone want to push https://github.com/vercel/next.js/pull/38870 over the finish line?
#38870 is now closed as stable, is this something we still want to look into? Or is this ticket still relevant without the need for that one?
Hi! 👋 I’d like to work on making next dev return a 405 status for non-GET/HEAD requests, matching next start behavior. My plan is to check the request method in the dev server route handling and return the appropriate 405 response for unsupported methods. Could you please assign this issue to me? Thanks!
Hi I would also like to work on this issue. I am a first time contributor and thing this would be great to help me get experienced with contributing to Next.js.