1.0.3 • Published 7 years ago
get-body v1.0.3
Get Body
General HTTP request body parser.
Looking for a multipart body parser? Try busboy.
Installation
npm install get-body --saveUsage
import { parse, json, text, form } from 'get-body'
import { createServer } from 'http'
createServer(function (req) {
parse(req, req.headers).then(body => console.log(body))
})Arguments
stream: ReadableAn instance of the request streamheaders: objectThe raw headers object as a lower-cased mapoptions: objectParser configuration
Options
limitControls the maximum request body size (default:100kb).decodersMap of knowncontent-encodingdecoders (default:exports.decoders)jsonParseCustom behaviour for JSON parsing (default: strictJSON.parsecheck)formParseCustom behaviour for form parsing (default:querystring.parse)jsonTypesArray of media types to parse as JSONformTypesArray of media types to parse as a formtextTypesArray of media types to parse as text
TypeScript
This project is written using TypeScript and publishes the definitions directly to NPM.
License
Apache 2.0