New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-body

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-body

General HTTP request body parser

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Get Body

NPM version NPM downloads Build status Test coverage

General HTTP request body parser.

Looking for a multipart body parser? Try busboy.

Installation

npm install get-body --save

Usage

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: Readable An instance of the request stream
  • headers: object The raw headers object as a lower-cased map
  • options: object Parser configuration

Options

  • limit Controls the maximum request body size (default: 100kb).
  • decoders Map of known content-encoding decoders (default: exports.decoders)
  • jsonParse Custom behaviour for JSON parsing (default: strict JSON.parse check)
  • formParse Custom behaviour for form parsing (default: querystring.parse)
  • jsonTypes Array of media types to parse as JSON
  • formTypes Array of media types to parse as a form
  • textTypes Array 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

Keywords

http

FAQs

Package last updated on 19 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts