
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@mimik/request-retry
Advanced tools
Example
import { rpRetry } from '@mimik/request-retry';
// or
import rp from '@mimik/request-retry';
Promise.<*>Make a request with retries.
Kind: inner method of request-retry
Returns: Promise.<*> - A bluebird promise (supports cancellation).
Category: async
Throws:
Error An error produced by getRichError, wrapping an
Axios error or a TimeoutError.The default retryStrategy is:
defaultRetry = (...args) => {
const { statusCode } = args[1]; // err
// Retry on 5xx and 429. If there is no statusCode, retry unless it's an "Invalid URI" error.
return (statusCode && (Math.floor(statusCode / 100) === 5 || statusCode === 429))
|| (!statusCode && !args[1].message.includes('Invalid URI'));
};
If not already set, the User-Agent header is set to:
mimik-{serverType}/{serverVersion}/{serverId} {architecture} {node}.
To ease migration from request-promise, the following adjustments are applied to options:
uri takes precedence over url.json is an object, body takes precedence over json; both are mapped to Axios data.qs is mapped to Axios params.Requires: module:@mimik/sumologic-winston-logger, module:@mimik/response-helper
Fulfil: object - The Axios response when resolveWithFullResponse is true; otherwise response.data.
| Param | Type | Default | Description |
|---|---|---|---|
| options | object | Options for the request (similar to axios). The validateStatus option is disabled: an error is thrown for status codes outside [200, 300). An additional option, resolveWithFullResponse, controls the return shape: when true, the full Axios response object is returned; when false or omitted, only response.data is returned. | |
| [options.retry] | object | Retry configuration. | |
| [options.retry.retries] | number | 2 | Maximum number of retries, independent of the retryStrategy. If the value is < 0, it is set to 0; if > 15, it is set to 15. |
| [options.retry.delay] | number | 1000 | Delay between retries in milliseconds when no delayStrategy is provided. If the value is < 20, it is set to 20; if > 30000, it is set to 30000. |
| [options.retry.delayStrategy] | function | A function that returns the delay (in milliseconds) to wait before the next retry. Signature: (nbRetry, err, options, correlationId). Must return a number > 0 and < 30000; otherwise delay is used. | |
| [options.retry.retryStrategy] | function | A function that decides whether to retry. Signature: (nbRetry, err, options, correlationId). Must return a boolean; otherwise it is ignored. | |
| [options.retry.timeout] | number | 50 | Request timeout (in seconds) applied to the initial request and all retries. If reached, a TimeoutError is thrown. Values < 10 are set to 10; values > 120 are set to 120. |
| [options.retry.logLevel] | object | Controls logging behavior. When omitted, requests and responses are logged at info with full details, and errors at warn. When provided but incomplete, only the provided keys are active; missing keys disable that logging. Non-object values are ignored and defaults apply. | |
| [options.retry.logLevel.response] | string | Log level for responses. Invalid values fall back to silly. | |
| [options.retry.logLevel.error] | string | Log level for errors. Invalid values fall back to silly. | |
| [options.retry.logLevel.request] | string | Log level for requests. Invalid values fall back to silly. | |
| [options.retry.logLevel.responseDetails] | string | "'type'" | Detail level for the response: count, type, or full. Invalid values fall back to type. When logLevel is omitted entirely, the default is full. |
| [options.retry.logLevel.responseName] | string | "'response'" | Label associated with the response. Non-string or empty values fall back to response. |
| [options.metrics] | object | Metrics configuration. | |
| [options.metrics.HTTPRequestDuration] | function | A prom-client metric function to measure request duration. | |
| [options.metrics.url] | string | Optional URL label for the metric. If omitted, the request URL is used. |
FAQs
Request retry wrapping axios
We found that @mimik/request-retry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.