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

http-body-parser

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-body-parser - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

uploads/38a63f7a-7505-454c-b75a-cddaa3c07753

11

lib/ParserFactory.js

@@ -14,3 +14,3 @@ 'use strict';

class ParserFactory {
constructor(req, enableTypes = ['json', 'form', 'text', 'multipart', 'stream'], parsers = {}) {
constructor(req, enableTypes = ['json', 'form', 'text', 'multipart', 'stream'], parsers = []) {
this.req = req;

@@ -21,6 +21,7 @@ this.enableTypes = enableTypes;

addParser(name, _Parser, options = {}) {
addParser(type, _Parser, options = {}) {
const Parser = _Parser;
Parser.type = type;
Parser.options = options;
this.parsers[name] = Parser;
this.parsers.push(Parser);
}

@@ -43,4 +44,4 @@

let parser = null;
Object.entries(this.parsers).forEach(([name, Parser]) => {
if (this.enableTypes.includes(name)) {
this.parsers.forEach(Parser => {
if (this.enableTypes.includes(Parser.type)) {
if ((0, _TypeIs2.default)(this.req, Parser.getTypes(Parser.options.extendsTypes))) {

@@ -47,0 +48,0 @@ parser = new Parser(body, this.req.headers, Parser.options.limit, Parser.options.path);

{
"name": "http-body-parser",
"version": "1.1.7",
"version": "1.1.8",
"description": "🎨 A body parser for node, koa, koa2, express. support json, form, text, multipart and stream type body.",

@@ -48,2 +48,3 @@ "main": "lib/index.js",

"babel-cli": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.4.0",

@@ -50,0 +51,0 @@ "eslint": "^3.19.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