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
Parse request bodies with generators inspired by Raynos/body.
Installation
$ npm install co-body
Options
limit number or string representing the request size limit (1mb for json and 56kb for form-urlencoded)
strict when set to true, JSON parser will only accept arrays and objects; when false will accept anything JSON.parse accepts. Defaults to true. (also strict mode will always return object).
onProtoPoisoning Defines what action the co-body lib must take when parsing a JSON object with __proto__. This functionality is provided by bourne.
See Prototype-Poisoning for more details about prototype poisoning attacks.
Possible values are 'error', 'remove' and 'ignore'.
Default to 'error', it will throw a SyntaxError when Prototype-Poisoning happen.
queryString an object of options when parsing query strings and form data. See qs for more information.
returnRawBody when set to true, the return value of co-body will be an object with two properties: { parsed: /* parsed value */, raw: /* raw body */}.
jsonTypes is used to determine what media type co-body will parse as json, this option is passed directly to the type-is library.
formTypes is used to determine what media type co-body will parse as form, this option is passed directly to the type-is library.
textTypes is used to determine what media type co-body will parse as text, this option is passed directly to the type-is library.