request-fork

Take a single request and send it to multiple targets

Usage no npm install needed!

<script type="module">
  import requestFork from 'https://cdn.skypack.dev/request-fork';
</script>

README

request-fork

Take a single request object and send it to multiple targets.

Install

npm install request-fork

Usage

var requestFork = require('request-fork')

var req = {
  method: 'GET',
  url: 'https://mockbin.com/status/502',
  headers: {
    'User-Agent': 'request-fork'
  }
}

var targets = [
  "https://mockbin.com/status/200",
  "https://mockbin.com/status/404"
]

requestFork(req, targets, function(responses, errors) {
  if (errors) throw errors
  responses.map(function(res){
    console.log(res.statusCode)
  })
})

Contributing

Feedback and pull requests are most welcomed.

MIT license

Copyright (c) 2015, Mashape (https://www.mashape.com/)