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

@capriza/http-utils

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capriza/http-utils - npm Package Compare versions

Comparing version 0.2.5-beta.4 to 0.2.5-beta.5

2

package.json
{
"name": "@capriza/http-utils",
"version": "0.2.5-beta.4",
"version": "0.2.5-beta.5",
"description": "HTTP Request utils that handles, request-response, errors, concurrency, priority and authentication",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,1 @@

VERSION=0.2.5-beta.3
VERSION=0.2.5-beta.4
VERSION=0.2.5-beta.5

@@ -5,3 +5,3 @@ # @capriza/http-utils

- [Installing](#Installing)
- [Configurations](#Configurations)
- [Instance Configuring](#Instance-Configuring)
- [headers](#headers)

@@ -12,2 +12,3 @@ - [timeout](#timeout)

- [maxRetries](#maxRetries)
- [retryInterval](#retryInterval)
- [retryOnNetworkErrors](#retryOnNetworkErrors)

@@ -22,4 +23,4 @@ - [retryStatusCodes](#retryStatusCodes)

## Overview
Http requests client based on [axios](https://www.npmjs.com/package/axios).<br />
Http-Utils supports rate limits, concurrent request, retries request etc.
Http requests client is based on[axios](https://www.npmjs.com/package/axios).<br />
The Http-Utils library supports rate limits, concurrent requests, retry requests, request prioritization etc.

@@ -32,20 +33,18 @@ ## Installing

## Configurations
There are several configurations for http-utils instance:
## Instance Configuring
An http-utils instance can be configured with the following properties:
### headers
default: `{ Accept: "application/json", Content-Type: "application/json" }`
default: ```{ Accept: "application/json", Content-Type: "application/json" }```
### timeout
Maximum duration (milliseconds) allowed for request execution
<br />
default: `30000`
<br />
Max time (milliseconds) for timeout
### baseUrl
Base url for all of the requests that will be executed by this instance
Base URL for requests executed by this instance.
### auth
Request authentication by username and password.
<br />
Should pass in this structure
Request authentication by username and password, formatted as follows:
```

@@ -56,27 +55,36 @@ { username : 'aaa', password : '123456' }

### maxRetries
Maximum retries permitted in case of server or network errors, depending on settings of [retryStatusCodes](#retryStatusCodes) and [retryOnNetworkErrors](#retryOnNetworkErrors), respectively.
<br />
default: `0`
max retries in case of failure
### retryInterval
Amount of time (milliseconds) between retries.
### retryOnNetworkErrors
Triggers retry of request when `ECONNABORTED` or `ECONNRESET` response is received.
<br />
default: `false`
Triggers retry request in case of `ECONNABORTED` or `ECONNRESET` response
### retryStatusCodes
If one of these values is received as the status code of the response, a retry of the request will be triggered.
<br />
default: `[502, 503, 504]`
Triggers retry request in case of response with status code that equal one of this values
### limit
Maximum number of http requests per [interval](#interval).
<br />
default: `Infinity`
Define max http requests per interval
### interval
Amount of time (milliseconds) during which the http requests [limit](#limit) can to be executed.
<br />
default: `1000`
Time (milliseconds) window for max http requests to be executed
### maxConcurrent
Number of requests allowed to execute simultaneously
<br />
default: `Infinity`
Define max concurrent requests
## Instance Methods
The available instance methods are listed below.
The available instance methods are listed below:

@@ -95,3 +103,3 @@ ```

## Examples
Defining instance with base url, 5 http request per 10 seconds, enable 3 retries in case of network error or 502, 503 status codes
Instance with base URL, 5 http requests allowed every 10 seconds, allowing 3 retries in case of network or server(502, 503) errors.
```

@@ -102,3 +110,3 @@ const HttpUtils = require('@capriza/http-utils');

limit: 5,
inerval: 10 * 1000,
interval: 10 * 1000,
retryOnNetworkErrors: true,

@@ -105,0 +113,0 @@ maxRetries: 3,

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