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

express-mung

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-mung - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

28

index.js

@@ -11,3 +11,7 @@ 'use strict';

mung.onError = (err, req, res) => {
res.status(500).json({ message: err.message }).end();
res
.status(500)
.set('content-language', 'en')
.json({ message: err.message })
.end();
return res;

@@ -19,3 +23,3 @@ };

let original = res.json;
function hook (json) {
function json_hook (json) {
let originalJson = json;

@@ -25,2 +29,4 @@ res.json = original;

return res;
if (res.statusCode >= 400)
return original.call(this, json);

@@ -52,3 +58,3 @@ // Run the munger

}
res.json = hook;
res.json = json_hook;

@@ -62,6 +68,8 @@ next && next();

let original = res.json;
function hook (json) {
function json_async_hook (json) {
res.json = original;
if (res.headersSent)
return;
if (res.statusCode >= 400)
return original.call(this, json);
try {

@@ -92,3 +100,3 @@ fn(json, req, res)

}
res.json = hook;
res.json = json_async_hook;

@@ -102,3 +110,3 @@ next && next();

let original = res.end;
function hook () {
function headers_hook () {
res.end = original;

@@ -118,3 +126,3 @@ if (!res.headersSent) {

}
res.end = hook;
res.end = headers_hook;

@@ -130,5 +138,5 @@ next && next();

res.end = original;
mung.onError(e, req, res);
return mung.onError(e, req, res);
};
function hook () {
function headers_async_hook () {
if (res.headersSent)

@@ -151,3 +159,3 @@ return original.apply(this, args);

}
res.end = hook;
res.end = headers_async_hook;

@@ -154,0 +162,0 @@ next && next();

{
"name": "express-mung",
"version": "0.4.1",
"version": "0.4.2",
"description": "Transform an express response (or make until no good)",

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

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