Socket
Socket
Sign inDemoInstall

bagofrequest

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bagofrequest

A bag-of-holding containing request utility functions.


Version published
Maintainers
1
Created
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

Package last updated on 14 Oct 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc