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

phin-retry

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phin-retry

The ultra-lightweight Node.js HTTP client

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
increased by8.12%
Maintainers
1
Weekly downloads
 
Created
Source

phin-retry

The ultra-lightweight Node.js HTTP client.

This is a wrapper around Phin that adds support for retry & looks like request-promise.

Install

npm install phin-retry

Usage

const request = require('phin-retry');

// should be used in async context
const post1 = await request.get('https://jsonplaceholder.typicode.com/posts/1');

const post2 = await request.get({
    url: 'https://jsonplaceholder.typicode.com/posts',
    qs: {
      id: 1
    },
    retry: 3,
    delay: 500
  });

All options from phin are supported. Refer Phin for more usage examples.

API

Methods

MethodDescriptionUsage
getperforms a GET request on the resourceawait request.get({})
postperforms a POST request on the resourceawait request.post({})
putperforms a PUT request on the resourceawait request.put({})
deleteperforms a DELETE request on the resourceawait request.delete({})
patchperforms a PATCH request on the resourceawait request.patch({})
headperforms a HEAD request on the resourceawait request.head({})

Options

It supports all options from phin, refer Phin more details.

MethodTypeDescription
urlstringrequest url
qsobjectquery parameters
authobjectauthentication object
retrynumbermax no of times to retry
delaynumberdelay between retries
bodyanyequivalent to data in phin
fullResponsebooleanreturns full phin response

By default, this library will retry once on failure (StatusCode < 200 & >= 300 ) with a delay of 100 milliseconds.

Keywords

FAQs

Package last updated on 29 Apr 2020

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