mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 13:27:15 +08:00
31 lines
924 B
TypeScript
31 lines
924 B
TypeScript
// Type definitions for requestretry 1.12
|
|
// Project: https://github.com/FGRibreau/node-request-retry
|
|
// Definitions by: Eric Byers <https://github.com/EricByers>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference types="node" />
|
|
|
|
import request = require('request');
|
|
import http = require('http');
|
|
|
|
type RetryStrategy = (err: Error, response: http.IncomingMessage, body: any) => boolean;
|
|
|
|
declare namespace requestRetry {
|
|
interface RequestAPI extends request.RequestAPI<request.Request, RequestRetryOptions, request.RequiredUriUrl> {
|
|
RetryStrategies: {
|
|
'HttpError': RetryStrategy;
|
|
'HTTPOrNetworkError': RetryStrategy;
|
|
'NetworkError': RetryStrategy;
|
|
};
|
|
}
|
|
|
|
interface RequestRetryOptions extends request.CoreOptions {
|
|
maxAttempts?: number;
|
|
retryDelay?: number;
|
|
retryStrategy?: RetryStrategy;
|
|
}
|
|
}
|
|
|
|
declare let requestretry: requestRetry.RequestAPI;
|
|
export = requestretry;
|