New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

polly-proxy

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polly-proxy

[![Greenkeeper badge](https://badges.greenkeeper.io/dustinsoftware/polly-proxy.svg)](https://greenkeeper.io/)

latest
npmnpm
Version
0.3.0
Version published
Weekly downloads
4
-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

polly proxy

Greenkeeper badge

A proxy server configurable at runtime that can record and replay HTTP web requests. Uses the Polly.JS library by Netflix, and node-http-proxy.

It was designed for use by applications written in any language (such as C#) that make external web requests during integration tests. Ideally you would consume Polly.JS directly in your tests so that the extra layer of indirection is unnecessary.

Usage:

  • Install polly-proxy via npx polly-proxy or npm i -g polly-proxy
  • Start the polly proxy service locally before your tests run.
  • Register a service to be proxied. You will receive a JSON response with the open port you can send requests to. (repeat for all services)
    • POST /addproxy?proxyPath=${encodeURIComponent('http://myservice.example.com')}.
  • Start a test session. Test data will be recorded using the provided test name.
    • POST /replay?testName=your-unique-test-name-here
    • Any API calls that were not present in the recorded data will be externally made and the response persisted.
      • Each time replay is called, the current replay will be stopped and started over from the beginning.
  • Make HTTP requests from your app, but change the base URL to http://localhost:(port). For example, if the port returned /addproxy was 56064, and the URL was http://myservice.example.com/getsomething/foo, have your app make requests to http://localhost:56064/getsomething/foo.
    • Right now the order of the requests does not matter, but you can fork this library and change the polly settings to whatever you want here
  • Stop the test session when your test completes. This will record a HAR file to disk locally, which will be used in future replays.
    • POST /stop?testName=your-unique-test-name-here
  • See this test as an example for how to consume the API
  • Read the Polly.JS documentation for more information on how the record-replay logic works.

Limitations:

  • Does not support parallel tests (yet!)
  • Proxies will be automatically cleaned up after a short time
  • The Polly.JS options are not yet configurable. Fork this library or open an issue with what you'd like to see exposed.

FAQs

Package last updated on 29 Jan 2019

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