Socket
Socket
Sign inDemoInstall

bagofrequest

Package Overview
Dependencies
2
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bagofrequest

A bag-of-holding containing request utility functions.


Version published
Weekly downloads
139
decreased by-22.35%
Maintainers
1
Install size
1.25 MB
Created
Weekly downloads
 

Changelog

Source

0.0.6

  • Change test to use buster-node + referee
  • Set min node engine to v0.8.0

Readme

Source
Avatar

Build Status Dependencies Status Published Version
npm Badge

Bag Of Request

Avatar

Bag Of Request contains request utility functions.

bag.request uses http://github.com/mikeal/request, with:

  • proxy setting based on environment variables http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY
  • excludes proxy if URL host is localhost or 127.0.0.1
  • thirty seconds default timeout
  • accepts self-signed SSL certificates
  • follow redirects by default
  • wildcard status code matching (e.g. 2xx, 50x)
  • custom handlers based on status code
  • default unexpected status code error with request body included in message
  • all bag.request defaults can be overriden by passing mikeal/request options
  • retry support with configurable delay

bag.proxy is a convenient function to retrieve proxy based on URL and environment value:

  • if URL uses http, then sets proxy to http_proxy or HTTP_PROXY
  • if URL uses https, then sets proxy to htps_proxy or HTTPS_PROXY or http_proxy or HTTP_PROXY
  • if URL does not have a protocol, then assume http protocol
  • if URL is not provided, then sets proxy to http_proxy or HTTP_PROXY or https_proxy or HTTPS_PROXY

Installation

npm install bagofrequest

or as a dependency in package.json file:

"dependencies": {
  "bagofrequest": "x.y.z"
}

Usage

var bag = require('bagofrequest');

bag.request('get', 'http://google.com.au', { timeout: 30000 }, function (err, result) {
});

var proxy = bag.proxy('https://google.com.au');

Keywords

FAQs

Last updated on 14 Oct 2013

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