Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reliable-get

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reliable-get

A circuit breaker and cached wrapper for GET requests (enables reliable external service interaction).

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
increased by233.33%
Maintainers
1
Weekly downloads
 
Created
Source

Reliable HTTP get wrapper (cache and circuit breaker), best wrapped around things you dont trust very much.

Build Status

Example options from Compoxure backend request:

var options = {
          url: targetUrl,
          cacheKey: targetCacheKey,
          cacheTTL: targetCacheTTL,
          timeout: utils.timeToMillis(backend.timeout || DEFAULT_LOW_TIMEOUT),
          headers: backendHeaders,
          tracer: req.tracer,
          statsdKey: 'backend_' + utils.urlToCacheKey(host),
          eventHandler: eventHandler
        };

From compoxure fragment request:

var options = {
      url: url,
      timeout: timeout,
      cacheKey: cacheKey,
      cacheTTL: cacheTTL,
      explicitNoCache: explicitNoCache,
      headers: optionsHeaders,
      tracer: req.tracer,
      statsdKey: statsdKey,
      eventHandler: eventHandler
  }
PropertyDescriptionExample / DefaultRequired
urlService to gethttp://my-service.tes.co.ukYes
timeoutTimeout for service5000No
cacheKeyKey to store cached value againstmy-service_tes_co_ukNo
cacheTTLTTL of cached value1 minuteNo
explicitNoCacheDo not cache under any circumstancesfalseNo
headersHeaders to send with requestNo
tracerUnique value to pass with requestNo
typeType of request, used for statsd and loggingNo
statsdKeyKey that statsd events will be posted toNo
eventHandlerObject (see below) for logging and statsNo

Event Handler

To allow Reliable Get to report back on status, at the moment we require you to pass in a simple object:

var eventHandler = {
  logger: function(level, message, data) {},
  stats: function(type, key, value) {}
}

This will likely get replaced with a more standard EventEmitter at some point when we get around to it (this is a legacy of the extraction of this code from another project for now).

Keywords

FAQs

Package last updated on 23 Nov 2014

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