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

koa-body

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-body - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

18

index.js

@@ -7,8 +7,22 @@ 'use strict';

module.exports = function(opts){
var patchNode = (opts && opts.patchNode) || false;
var patchKoa = (opts && opts.patchKoa) || true;
return function *(next){
if(this.is('application/json')){
this.request.body = yield co_body.json(this);
var body = yield co_body.json(this);
if(patchNode){
this.req.body = body;
}
if(patchKoa){
this.request.body = body;
}
}
else if(this.is('application/x-www-form-urlencoded')){
this.request.body = yield co_body.form(this);
var body = yield co_body.form(this);
if(patchNode){
this.req.body = body;
}
if(patchKoa){
this.request.body = body;
}
}

@@ -15,0 +29,0 @@ yield next;

2

package.json
{
"name": "koa-body",
"version": "0.0.2",
"version": "0.0.3",
"description": "Simple wrapper around co-body for koa",

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

@@ -6,2 +6,4 @@

Doesn't support multipart
## Installation

@@ -15,4 +17,9 @@

TODO
- patchNode
Set the body parameter in the node request object `this.req.body`
*defauls to false*
- patchKoa
Set the body parameter in the koa request object `this.request.body`
*defaults to true*
## Example

@@ -19,0 +26,0 @@

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