Socket
Socket
Sign inDemoInstall

http-replay

Package Overview
Dependencies
24
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    http-replay

Dump http request for testing.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
806 kB
Created
Weekly downloads
 

Readme

Source

http-replay

A simple http dump-replay tool for testing koa-based apps.

Install

`$ npm instal http-replay --save-dev`

Usage

Dump


const dump_request = require('http-replay').dump

app.use(dump_request({
  enabled: DEBUG_MODE,
  bypassStatic: true
}))


Testing with supertest


let server = require('./app')
let tester = require('http-replay').test

describe('Application', function() {
  this.timeout(10000)

  it('should replay requests', function(done) {

    tester({
      server: server,
      savePath: path.join(process.cwd(), 'http-replay-dump.json'),
      fuzzyHtml: false
    }).promise.then(function(results) {
      let errs = results.filter(function(e){ return e.err })
      if (errs.length) {
        done(new Error(errs.map(function(e){ return `Path: ${e.res.req.path} \t ${e.err}`}).join('\n')))
      } else {
        done()
      }
    })

  })
})

Options

Dump

  • enabled - Bool
  • savePath - String, path to save dump data
  • bypassStatic - Bool, Bypath static file or not
  • verbose: Bool, pretty print dump data or not

Test

  • savePath - String, where your dump data stores
  • fuzzyHtml - String, fuzzy expect(body) when Content-Type is html

License

MIT

FAQs

Last updated on 15 Oct 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc