Skip to content

Commit 917f5ae

Browse files
committed
docs: add documentation and types
1 parent 8ee7656 commit 917f5ae

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

docs/docs/api/RetryHandler.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Extends: [`Dispatch.DispatchOptions`](Dispatcher.md#parameter-dispatchoptions).
2929
- **methods** `string[]` (optional) - Array of HTTP methods to retry. Default: `['GET', 'PUT', 'HEAD', 'OPTIONS', 'DELETE']`
3030
- **statusCodes** `number[]` (optional) - Array of HTTP status codes to retry. Default: `[429, 500, 502, 503, 504]`
3131
- **errorCodes** `string[]` (optional) - Array of Error codes to retry. Default: `['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'ENETDOWN','ENETUNREACH', 'EHOSTDOWN', 'UND_ERR_SOCKET']`
32+
- **ifMatch** `boolean` (optional) - It enables the send of `if-match` pre-condition header if `etag` is present in the first response. Default: `true`
3233

3334
**`RetryContext`**
3435

test/types/retry-agent.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RetryAgent, Agent } from '../..'
44
const dispatcher = new Agent()
55

66
expectAssignable<RetryAgent>(new RetryAgent(dispatcher))
7-
expectAssignable<RetryAgent>(new RetryAgent(dispatcher, { maxRetries: 5 }))
7+
expectAssignable<RetryAgent>(new RetryAgent(dispatcher, { maxRetries: 5, ifMatch: false }))
88

99
{
1010
const retryAgent = new RetryAgent(dispatcher)

types/retry-handler.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ declare namespace RetryHandler {
107107
* @default [500, 502, 503, 504, 429],
108108
*/
109109
statusCodes?: number[];
110+
/**
111+
* Enables/disabled the usage of `If-Match` pre-condition header for retry requests.
112+
* @type {boolean}
113+
* @memberof RetryOptions
114+
* @default true
115+
*/
116+
ifMatch?: boolean;
110117
}
111118

112119
export interface RetryHandlers {

0 commit comments

Comments
 (0)