npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jeffhandley/capture-proxy

v0.2.7

Published

A http proxy that can be used to intercept http requests and persist the request and response payloads.

Downloads

10

Readme

capture-proxy

Build Status

capture-proxy is a basic nodejs proxy that allows requests and responses to be captured and optionally replayed at another point in time like the curl command.

This is achieved by pointing the application or browser to the capture-proxy which will then forward the request onto the target endpoint.

Installation

Using npm:

$ npm install -g capture-proxy

Capturing Requests and Responses

Capture HttpRequests and HttpResponses using the capture command.

  Usage: capture <applicationRoot> [options]

  Commands:

    replay [options]       Re-issue a request from a previously recorded
                           file
    alias                  Save a request file as a global alias that can
                           be referenced from any location on the system

  Options:

    -h, --help               output usage information
    -V, --version            output the version number
    -p, --port <portNumber>  Port number to start listening on [8000]
    -r, --response           Save responses
    -R, --request            Save requests and responses
    -a, --ashost <hostName>  Set the host header on the proxied request. By default the `host` is based on the application root
    -o, --output [location]  When request or response capture is enabled,
                             save files to this folder [./output]
    -k, --insecure           Allow connections to SSL sites without valid
                             certs
    -z, --zip                Enable compression. By default the
                             `accept-encoding` header is removed
    -v, --verbose            Output requests and responses

Capture is a http proxy that can be used to intercept http requests and
persist the request and response payloads.

<applicationRoot> is the mounting point for the proxy. (e.g.
http://my.host.com/application/root/)

Example

# mount http://localhost:3000/
# save both requests and responses to ./captures folder
$ capture http://www.google.com/ -p 3000 -R -o ./captures

Other Commands

replay

Replay can be used as an alternative to curl. It condenses many of the different curl options into a HttpRequest file.

  Usage: replay <file|alias> [options]

  Options:

    -h, --help      output usage information
    -H, --headers   Output headers
    -k, --insecure  Allow connections to SSL sites without valid certs
    -v, --verbose   Output requests

Example

Replay by file

# load the contents of ./captures/home.req an re-issue the request
# ignoring SSL errors
$ capture replay ./captures/home.req -k

Replay by alias

# load an aliased request named `myAlias` and re-issue it
$ capture replay myAlias

alias

Saves a HttpRequest file as an alias that can be later used with the replay command

  Usage: alias <alias> <requestFile>

  Options:

    -h, --help  output usage information

Example

# create the alias `myAlias` for request file ./captures/home.req
$ capture alias myAlias ./captures/home.req

Why?

Sometimes fiddler isn't an option. This is a very crude and basic alternative to inspecting the requests and responses driven by a personal need to reverse engineer the invokation of SOAP services.

Issues

  • It will handle basic web page requests however static resource references are still a problem
  • Cookie management
  • Redirects
  • Binary data - don't currently know how to handle binary data when it comes to replaying requests

TODO

  • Running the proxy under https