Socket
Socket
Sign inDemoInstall

express-modify-response

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-modify-response

middleware that allows you to modify the response sent


Version published
Weekly downloads
1.4K
increased by15.05%
Maintainers
1
Install size
4.29 kB
Created
Weekly downloads
 

Readme

Source

#express-modify-response

Example Usage

var expressModifyResponse = require('express-modify-response');
var app = ...

app.use(expressModifyResponse(
    (req, res) => {
        // return true if you want to modify the response later
        if (res.getHeader('Content-Type').startsWith('text/html')) return true;
        return false;
    },
    (req, res, body) => {
        // body is a Buffer with the current response; return Buffer or string with the modified response
        // can also return a Promise.
        return body.toString() + '<script>console.log("hello");</script>';
    }
));

Keywords

FAQs

Last updated on 04 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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