New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

proxy-gremlin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxy-gremlin

Utility to assist in changing proxied requests.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

Proxy Gremlin

Proxy Gremlin is a tiny library that helps you to intercept and alter proxied responses. It is a middleware-type tool intended for use with node-http-proxy.

Example

var http    = require('http')
  , proxy   = require('http-proxy')
  , gremlin = require('proxy-gremlin')

http.createServer(function(req, res) { // start an http server

  // Proxy the request
  proxy.proxyRequest(req, res, {
    host: proxiedHost, // put your proxied host here
    port: proxiedPort  // put your proxied port here
  })

  // tell proxy-gremlin to intercept this response before it goes out
  gremlin.intercept(res, function interceptor(buffer) {

    // log buffered response info
    console.log(buffer.headers)
    console.log(buffer.encoding)
    console.log(buffer.statusCode)
    console.log(buffer.getData())

    // change the response
    buffer.headers['Content-Type'] = 'text/html' // change a header
    buffer.setData('Hello world')                // change the response's data
  })

}).listen(8080)

License

MIT

Keywords

FAQs

Package last updated on 10 Mar 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc