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

liquid-proxy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquid-proxy

  • 0.0.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Liquid Proxy

Build status Gem Version

Overview

Http proxy that you can instruct via api to inject arbitrary headers into requests passing through.

Why? I needed it to recreate parts of live infrustructure in test environment (namely, the app under test was behind the proxy that takes care of authenticating users and passes on its checks in the form of http header).

Usage

This is a ruby gem and it requires ruby >= 1.9.2.

# Gemfile
gem 'liquid-proxy'

The following example shows usage with cucumber/capybara/selenium:

# env.rb
require 'capybara'
require 'selenium-webdriver'
require 'liquid-proxy'
    
LiquidProxy.start(port: 9889)
    
Capybara.configure do |config|
  config.default_driver = :selenium
  config.run_server     = false
  config.app_host       = "http://test.example.com"
end
        
Capybara.register_driver :selenium do |app|
  profile       = Selenium::WebDriver::Firefox::Profile.new
  profile.proxy = Selenium::WebDriver::Proxy.new(http: 'localhost:9889', type: :manual)

  Capybara::Selenium::Driver.new(app, profile: profile)
end

# let tests start clean
Before do
  LiquidProxy.headers_to_inject.clear
end

Then in step definitions you can:

# set headers to inject
LiquidProxy.headers_to_inject = {'Foo' => 'Bar', 'Accept' => 'Cash'}
    
# add to headers to inject
LiquidProxy.headers_to_inject['X_HACKERY'] = 'BOOM'
    
# clear headers to inject
LiquidProxy.headers_to_inject.clear

Standalone usage

If you are not using ruby, it is possible to run liquid-proxy as a standalone process and controll it via REST api:

# install
bash$ gem install liquid-proxy

# start
bash$ liquid-proxy 8998

# add headers
bash$ curl --data-binary '{"Foo":"Bar","Accept":"Cash"}' http://localhost:8998

# clear headers
bash$ curl -X DELETE http://localhost:8998

Author

Artem Avetisyan

FAQs

Package last updated on 05 May 2016

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