Socket
Socket
Sign inDemoInstall

co-body

Package Overview
Dependencies
2
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-body


Version published
Weekly downloads
1M
increased by0.7%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

co-body

Parse request bodies with generators inspired by Raynos/body.

Installation

$ npm install co-body

Options

Available via raw-body:

  • limit number or string representing the request size limit (1mb for json and 56kb for form-urlencoded)

Example

// application/json
var body = yield parse.json(req);

// explicit limit
var body = yield parse.json(req, { limit: '10kb' });

// application/x-www-form-urlencoded
var body = yield parse.form(req);

// either
var body = yield parse(req);

Koa

This lib also supports ctx.req in Koa (or other libraries), so that you may simply use this instead of this.req.

// application/json
var body = yield parse.json(this);

// application/x-www-form-urlencoded
var body = yield parse.form(this);

// either
var body = yield parse(this);

License

MIT

Keywords

FAQs

Last updated on 10 Jun 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc