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

yakbak-proxy

v1.7.0

Published

Yakbak proxy for reading/writing tapes of network interactions

Downloads

76

Readme

yakbak-proxy

Copyright (C) 2020 The Open Library Foundation

This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.

Overview

yakbak-proxy is a simple Web proxy implemented using yakbak. It accepts incoming HTTP connections and proxies them through the nominated server, keeping a record ("tapes") of all requests and their corresponding responses. Then later you can run the same client against the same proxy server, and it will re-use the tapes. This is especially useful for testing a Web UI away from its corresponding back-end.

This code was derived from the five-line sample proxy-server in the YakBak docs.

Usage

yakbak-proxy [options] <serverUrl>

The serverUrl must be specified, and is the full URL of the HTTP or HTTPS service to be proxied. The following options are recognised:

  • -n or --norecord -- Fail requests for which no tape has been stored by an earlier run [default: false]. In this mode, yakbak-proxy will never visit the server it is proxying for, but will only serve up previously taped responses.
  • -i or --ignoreheaders -- Exclude request headers from the hash function [default: false]. The response corresponding to any given request is looked up by means of a hashcode derived from the request, including the HTTP version, method, URL path and query, headers and trailers. In some situations, this is too precise, because you may need to submit the "same" request with different headers. When --ignoreheaders is specified, the headers are not included in the request hash, so that a taped response will be returned provided the other parts of the request match irrespective of what the headers are.
  • -x or --exciseid -- Excise 'id' fields from POST requests for the purposes of calculating the request's hashcode. This allows otherwise-identical POSTs that have different auto-generated ids to hash to the same tape.
  • -p num or --port num -- Listen on the specified port number [default: 3002].
  • -t dir or --tapes dir -- Store the tapes in the specified directory [default: tapes].

Logging

Logging is done using categorical-logger. This is configured by seting the LOGGING_CATEGORIES or LOGCAT environment variable (they are equivalent) to a comma-separated list of the categories of log messages that you want to see. Supported categories include:

  • startup -- log a single message at startup stating the listening port and the proxied site.
  • request -- log each request, stating the tape filename (truncated to eight character), the method and the path.
  • requestfull -- log each request, stating the full tape filename, the method and the path.

Example

LOGCAT=startup yakbak-proxy.js -i -t yakbak/tapes https://folio-snapshot-okapi.dev.folio.org

This runs the proxy, logging a single line when starting up, ignoring headers for the purposes of distinguishing requests, storing tapes in (and reading tapes from) yakbak/tapes and proxying the FOLIO Snapshot OKAPI web-service. The proxy listens on the default port 3002.