Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
A body arrives as bytes or text, not a trusted JavaScript object. Parse its format, enforce size limits, and validate its shape and values.
In node:http, the request is a readable stream. A framework body parser can collect and parse JSON, but parsing only establishes valid JSON syntax. An array, null, or an object with wrong field types can all be valid JSON and still invalid input. Check Content-Type as appropriate, set a body-size limit, and validate allowed fields and business constraints before using them.