Parse the request body in koa like ya' used to in express
JavaScript Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test Allow double parsing Jun 10, 2014
.gitignore Initial commit Feb 10, 2014
.travis.yml Initial commit Feb 10, 2014
CHANGELOG.md Changelog Jun 10, 2014
LICENSE Initial commit Feb 10, 2014
Makefile Initial commit Feb 10, 2014
Readme.md Depreciation Note Mar 12, 2016
index.js Bump co-body to ^2.0.0 May 10, 2015
package.json Bump to co-body 4.0.0 Nov 7, 2015

Readme.md

This project has been depreciated in favour of: https://github.com/koajs/bodyparser


koa-body-parser Build Status

Parse the request body in koa like ya' used to in express

Installation

npm install koa-body-parser

Options

  • empty whether to throw a 415 if the client has indicated there is a body but it cannot be parsed (default: true)
  • length length limit of the stream to pass to raw-body (default: content-length)
  • limit byte limit of the body to pass to raw-body, throws 413 if body is larger
  • encoding requested encoding (default: utf8)

Example

var bodyParser = require('koa-body-parser');
var koa = require('koa');

var app = koa();

app.use(bodyParser());

app.use(function *() {
  this.body = this.request.body; // Echo request back
  this.status = 200;
});

app.listen(3000);

License

MIT