open-index/open-npm huggingface dataset:
npm package: @mapbox/assert-http
Description: HTTP test fixture helper
Author: Mapbox
Latest version: 3.2.0

Assert HTTP
-----------

Test helpers for testing a HTTP interface. This library contains two primary interfaces; a test runner which executes a set of HTTP calls as described by files in a directory, and a extension to the assert module.

[![Build Status](https://travis-ci.com/mapbox/assert-http.svg?branch=master)](https://travis-ci.com/mapbox/assert-http)

## HTTP testing inferface

With [mocha](http://mochajs.org/), usage looks like;

```
describe('api server', function(done) {
    fixtures.load('/path/to/tests/').forEach(function(test) {
        it(test.name, function(done) {
            fixtures.runtest(test, {handlers: handlers, clean: clean}, done);
        });
    });
});
```

### assertHTTP.load(dirname)

Syncronous function that loads text fixtures from a directory. Returns an array of test objects.

### assertHTTP.runtest(test, options, callback)

Runs an individual test. Requires a test object (from assertHTTP.load), options object and callback function. The options object may contain the keys;

* `handlers`; an object of keys and replacer methods for populating http requests. Handlers are async and have the function signature `function(req, value, next)`
* `clean`; an object of keys and replacer methods for sanitizing http response headers and body. Replacer methodes have the signature `function(key, value, context)`

### assertHTTP.updateFixtures()

Call this method to notify assertHTTP to update fixtures as it runs.

### assertHTTP.mkdirpSync(path)

Sync version of mkdirp

### assertHTTP.md5(string)

md5 helper.

### assertHTTP.imageEquals(buffer, buffer, options)

A pixel-by-pixel comparison of two image buffers using the node-mapnik `Image.compare()` API. The options object may contain the keys:

* `threshold`; tolerance level of RGB value difference between two pixels. Defaults to 16.
* `diffsize`; a float between 0-1 expressing the max allowed difference between buffer lengths. Defaults to 0.1.
* `diffpx`; a float between 0-1 expressing the max number of pixels allowed to exceed the `threshold` option. Defaults to 0.02.

## Assertion module extension

### assert.response(req, res, callback)

If `res.clean` is present it is expected to be a method that `json.stringify` can use to sanitize the response headers.
npm package: @mapbox/aws-log-replay
Description: Transform and replay CloudFront, ELB Classic, and ALB logs.
Author: Mapbox
Latest version: 4.3.0

# aws-log-replay

```
npm i @mapbox/aws-log-replay
```

Transform and replay a stream of AWS CloudFront, ELB Classic, or ALB logs. You can use [s3scan](https://github.com/mapbox/s3scan) to easily stream logs into these tools.

This project uses the AWS JavaScript SDK: you will need to [configure your own credentials](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html).

## generatepath

Takes different types of logs as input and streams  an object to `stdout`. Format of the output:
```js
{
  "path": "/a.json?option=1", 
  "method": "GET", // can be GET or HEAD
  "referer": "Referer" // for 'cloudfront' type only
}
```
Supported types include "cloudfront" for CloudFront logs and "lb" for ELB Classic or ALB logs.

```sh
Usage: generatepath <type>
```

## pathreplay

Makes replay requests to the `baseurl`. Expects paths to be piped to `stdin`. (Optional) Control concurrency of replay requests with `--concurrency` flag. Default is 100.

```sh
Usage: pathreplay <baseurl> [--concurrency=<n>]
```

## sample

Emits a repeatable set of input lines piped to `stdin` at a given sampling rate. The number of lines emitted will approach the specific rate over sufficiently large samples, but may diverge for small sample sizes. Sampling rates should be specified as a decimal number between zero and one. Optionally accepts a `filter` argument that restricts the sampled set to lines matching the specified regular expression.

```sh
Usage: sample --rate=<rate> [--filter=<filter>]
```