Socket
Socket
Sign inDemoInstall

mappersmith

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mappersmith - npm Package Compare versions

Comparing version 2.15.1 to 2.16.0

middleware/retry/index.js

2

mappersmith.js

@@ -18,3 +18,3 @@ 'use strict';

/* global VERSION */
var version = exports.version = '2.15.1';
var version = exports.version = '2.16.0';

@@ -21,0 +21,0 @@ var configs = exports.configs = {

{
"name": "mappersmith",
"version": "2.15.1",
"version": "2.16.0",
"description": "It is a lightweight rest client for node.js and the browser",

@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>",

@@ -579,3 +579,33 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith)

##### v2
It's possible to configure the header names and parameters used in the calculation by providing a configuration object when creating the middleware.
If no configuration is passed when creating the middleware then the defaults will be used.
```javascript
import Retry from 'mappersmith/middleware/retry/v2'
const retryConfigs = {
headerRetryCount: 'X-Mappersmith-Retry-Count',
headerRetryTime: 'X-Mappersmith-Retry-Time',
maxRetryTimeInSecs: 5,
initialRetryTimeInSecs: 0.1,
factor: 0.2, // randomization factor
multiplier: 2, // exponential factor
retries: 5, // max retries
validateRetry: (response) => response.responseStatus >= 500 // a function that returns true if the request should be retried
}
const client = forge({
middleware: [ Retry(retryConfigs) ],
/* ... */
})
```
##### v1 (deprecated)
The v1 retry middleware is now deprecated as it relies on global configuration which can cause issues if you need to have multiple different configurations.
```javascript
import Retry from 'mappersmith/middleware/retry'

@@ -589,3 +619,3 @@

It's possible to configure the header names and parameters used in the calculation.
It's possible to configure the header names and parameters used in the calculation by calling the deprecated setRetryConfigs method.

@@ -592,0 +622,0 @@ ```javascript

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