-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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 interface extensions #7363
API interface extensions #7363
Conversation
Stats from current PRClick to expand stats
Click to expand serverless stats
|
I wouldn't do body parsing out of the box. What if I want to consume the incoming message as a stream? What if I intend to just proxy it? |
Stats from current PRClick to expand stats
Click to expand serverless stats
|
I think it's better to allow each project to extend/override the |
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
@huv1k (cc @timneutkens ) Would like to voice my concerns again, as they seem to have gone by unnoticed. I think parsing the request body as out-of-the-box behavior is problematic.
I'd like to propose a few alternatives:
const body = await req.json();
import { handler } from 'next/api'
export default handler((req, res) => {
res.json(req.body);
}); Which could even be as much as bundling
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
We're going to provide a way to opt-out soon. |
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
This improves the interface for
API
routes.req.cookie
req.query
req.body
req.send
req.json