Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-body-parser

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-body-parser - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

CHANGELOG.md

4

index.js

@@ -25,5 +25,5 @@

if (encoding || length) {
if ((encoding || length) && !this.req._readableState.ended) {
try {
this.request.body = yield parse(this.request);
this.request.body = yield parse(this.request, opts);
} catch (err) {

@@ -30,0 +30,0 @@ if (err.status !== 415 || !empty)

{
"name": "koa-body-parser",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parse request body into ctx.request.body",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,2 +14,5 @@

- `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`)

@@ -16,0 +19,0 @@ ## Example

@@ -42,3 +42,21 @@

describe('empty body', function () {
it('should allow body to be parsed twice', function (done) {
var app = koa();
app.use(parseBody());
app.use(parseBody());
app.use(function *() {
this.request.body.should.eql({ hello: 'world' });;
this.status = 200;
});
request(app.listen())
.post('/')
.set('Content-Type', 'application/json')
.send({ hello: 'world' })
.expect(200, done);
});
describe('with an empty body', function () {
it('should not throw when GET', function (done) {

@@ -45,0 +63,0 @@ var app = koa();

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc