Socket
Socket
Sign inDemoInstall

express-mung

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "express-mung",
"version": "0.1.0",
"version": "0.1.1",
"description": "Transform an express response (or make until no good)",

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

@@ -41,8 +41,14 @@ # express-mung [![Build Status](https://travis-ci.org/richardschneider/express-prefer.svg)](https://travis-ci.org/richardschneider/express-mung)

See the mocha [tests](https://github.com/richardschneider/express-mung/tree/master/test) for some more examples.
## Reference
- `mung.json(fn)` transform the JSON body of the response. `fn` receives the JSON as an object, the `req` and `res`. It returns the modified body. If `undefined` is returned (i.e. nothing) then original JSON is assumed to be modified. If `null` is returned, then a 204 No Content HTTP status is returned to client.
- `mung.json(fn)` transform the JSON body of the response. `fn(json, req, res)` receives the JSON as an object, the `req` and `res`. It returns the modified body. If `undefined` is returned (i.e. nothing) then the original JSON is assumed to be modified. If `null` is returned, then a 204 No Content HTTP status is returned to client.
- `mung.jsonAsync(fn)` transform the JSON body of the response. `fn` receives the JSON as an object, the `req` and `res`. It returns a promise to a modified body. The promise returns an object. If it is `null` then a 204 No Content is sent to the client.
- `mung.jsonAsync(fn)` transform the JSON body of the response. `fn(json, req, res)` receives the JSON as an object, the `req` and `res`. It returns a promise to a modified body. The promise returns an `object.` If it is `null` then a 204 No Content is sent to the client.
- `mung.headers(fn)` transform the HTTP headers of the response. `fn(req, res)` receives the `req` and `res`. It should modify the header(s) and then return.
- `mung.headersAsync(fn)` transform the HTTP headers of the response. `fn(req, res)` receives the `req` and `res`. It returns a `promise` to modify the header(s).
# License

@@ -49,0 +55,0 @@ The MIT license

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc