mappersmith
Advanced tools
Comparing version 2.15.1 to 2.16.0
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103570
40
2035
1003