From da270178425d13ef54f0bd5969c3675c219a62d0 Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Sun, 21 Apr 2024 14:22:51 +0200 Subject: [PATCH 1/5] feat: add support for ifmatch over retry-handler --- lib/handler/retry-handler.js | 35 ++-- test/retry-handler.js | 318 +++++++++++++++++++++++++++++++++++ 2 files changed, 339 insertions(+), 14 deletions(-) diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index 2258801ba58..b9ec7f34ba2 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -7,9 +7,7 @@ const { isDisturbed, parseHeaders, parseRangeHeader } = require('../core/util') function calculateRetryAfterHeader (retryAfter) { const current = Date.now() - const diff = new Date(retryAfter).getTime() - current - - return diff + return new Date(retryAfter).getTime() - current } class RetryHandler { @@ -22,6 +20,7 @@ class RetryHandler { maxTimeout, minTimeout, timeoutFactor, + ifMatch, // Response scoped methods, errorCodes, @@ -36,6 +35,7 @@ class RetryHandler { this.aborted = false this.retryOpts = { retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry], + ifMatch: ifMatch ?? true, retryAfter: retryAfter ?? true, maxTimeout: maxTimeout ?? 30 * 1000, // 30s, minTimeout: minTimeout ?? 500, // .5s @@ -64,6 +64,7 @@ class RetryHandler { this.start = 0 this.end = null this.etag = null + this.isWeakEtag = false this.resume = null // Handle possible onConnect duplication @@ -116,11 +117,7 @@ class RetryHandler { const { counter } = state // Any code that is not a Undici's originated and allowed to retry - if ( - code && - code !== 'UND_ERR_REQ_RETRY' && - !errorCodes.includes(code) - ) { + if (code && code !== 'UND_ERR_REQ_RETRY' && !errorCodes.includes(code)) { cb(err) return } @@ -246,10 +243,7 @@ class RetryHandler { start != null && Number.isFinite(start), 'content-range mismatch' ) - assert( - end != null && Number.isFinite(end), - 'invalid content-length' - ) + assert(end != null && Number.isFinite(end), 'invalid content-length') this.start = start this.end = end @@ -270,6 +264,10 @@ class RetryHandler { this.resume = resume this.etag = headers.etag != null ? headers.etag : null + if (this.etag != null) { + this.isWeakEtag = this.etag.startsWith('W/') + } + return this.handler.onHeaders( statusCode, rawHeaders, @@ -308,7 +306,9 @@ class RetryHandler { // and server error response if (this.retryCount - this.retryCountCheckpoint > 0) { // We count the difference between the last checkpoint and the current retry count - this.retryCount = this.retryCountCheckpoint + (this.retryCount - this.retryCountCheckpoint) + this.retryCount = + this.retryCountCheckpoint + + (this.retryCount - this.retryCountCheckpoint) } else { this.retryCount += 1 } @@ -328,11 +328,18 @@ class RetryHandler { } if (this.start !== 0) { + const headers = { range: `bytes=${this.start}-${this.end ?? ''}` } + + // Weak etag check - weak etags will make comparison algorithms never match + if (this.retryOpts.ifMatch && this.etag != null && !this.isWeakEtag) { + headers['if-match'] = this.etag + } + this.opts = { ...this.opts, headers: { ...this.opts.headers, - range: `bytes=${this.start}-${this.end ?? ''}` + ...headers } } } diff --git a/test/retry-handler.js b/test/retry-handler.js index 2596a7d80cb..43608903974 100644 --- a/test/retry-handler.js +++ b/test/retry-handler.js @@ -979,3 +979,321 @@ test('Issue#2986 - Handle custom 206', async t => { await t.completed }) + +test('Issue#3128 - Support if-match', async t => { + t = tspl(t, { plan: 9 }) + + const chunks = [] + let counter = 0 + + // Took from: https://github.com/nxtedition/nxt-lib/blob/4b001ebc2f22cf735a398f35ff800dd553fe5933/test/undici/retry.js#L47 + let x = 0 + const server = createServer((req, res) => { + if (x === 0) { + t.deepStrictEqual(req.headers.range, 'bytes=0-3') + res.setHeader('etag', 'asd') + res.write('abc') + setTimeout(() => { + res.destroy() + }, 1e2) + } else if (x === 1) { + t.deepStrictEqual(req.headers.range, 'bytes=3-') + t.deepStrictEqual(req.headers['if-match'], 'asd') + + res.setHeader('content-range', 'bytes 3-6/6') + res.setHeader('etag', 'asd') + res.statusCode = 206 + res.end('def') + } + x++ + }) + + const dispatchOptions = { + retryOptions: { + retry: function (err, _, done) { + counter++ + + if (err.code && err.code === 'UND_ERR_DESTROYED') { + return done(false) + } + + if (err.statusCode === 206) return done(err) + + setTimeout(done, 800) + } + }, + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json' + } + } + + server.listen(0, () => { + const client = new Client(`http://localhost:${server.address().port}`) + const handler = new RetryHandler(dispatchOptions, { + dispatch: (...args) => { + return client.dispatch(...args) + }, + handler: { + onRequestSent () { + t.ok(true, 'pass') + }, + onConnect () { + t.ok(true, 'pass') + }, + onBodySent () { + t.ok(true, 'pass') + }, + onHeaders (status, _rawHeaders, resume, _statusMessage) { + t.strictEqual(status, 200) + return true + }, + onData (chunk) { + chunks.push(chunk) + return true + }, + onComplete () { + t.strictEqual(Buffer.concat(chunks).toString('utf-8'), 'abcdef') + t.strictEqual(counter, 1) + }, + onError () { + t.fail() + } + } + }) + + client.dispatch( + { + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json', + Range: 'bytes=0-3' + } + }, + handler + ) + + after(async () => { + await client.close() + + server.close() + await once(server, 'close') + }) + }) + + await t.completed +}) + +test('Issue#3128 - Should ignore weak etags', async t => { + t = tspl(t, { plan: 9 }) + + const chunks = [] + let counter = 0 + + // Took from: https://github.com/nxtedition/nxt-lib/blob/4b001ebc2f22cf735a398f35ff800dd553fe5933/test/undici/retry.js#L47 + let x = 0 + const server = createServer((req, res) => { + if (x === 0) { + t.deepStrictEqual(req.headers.range, 'bytes=0-3') + res.setHeader('etag', 'W/asd') + res.write('abc') + setTimeout(() => { + res.destroy() + }, 1e2) + } else if (x === 1) { + t.deepStrictEqual(req.headers.range, 'bytes=3-') + t.equal(req.headers['if-match'], undefined) + + res.setHeader('content-range', 'bytes 3-6/6') + res.setHeader('etag', 'W/asd') + res.statusCode = 206 + res.end('def') + } + x++ + }) + + const dispatchOptions = { + retryOptions: { + retry: function (err, _, done) { + counter++ + + if (err.code && err.code === 'UND_ERR_DESTROYED') { + return done(false) + } + + if (err.statusCode === 206) return done(err) + + setTimeout(done, 800) + } + }, + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json' + } + } + + server.listen(0, () => { + const client = new Client(`http://localhost:${server.address().port}`) + const handler = new RetryHandler(dispatchOptions, { + dispatch: (...args) => { + return client.dispatch(...args) + }, + handler: { + onRequestSent () { + t.ok(true, 'pass') + }, + onConnect () { + t.ok(true, 'pass') + }, + onBodySent () { + t.ok(true, 'pass') + }, + onHeaders (status, _rawHeaders, resume, _statusMessage) { + t.strictEqual(status, 200) + return true + }, + onData (chunk) { + chunks.push(chunk) + return true + }, + onComplete () { + t.strictEqual(Buffer.concat(chunks).toString('utf-8'), 'abcdef') + t.strictEqual(counter, 1) + }, + onError () { + t.fail() + } + } + }) + + client.dispatch( + { + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json', + Range: 'bytes=0-3' + } + }, + handler + ) + + after(async () => { + await client.close() + + server.close() + await once(server, 'close') + }) + }) + + await t.completed +}) + +test('Weak etags are ignored on range-requests', { only: true }, async t => { + t = tspl(t, { plan: 9 }) + + const chunks = [] + let counter = 0 + + // Took from: https://github.com/nxtedition/nxt-lib/blob/4b001ebc2f22cf735a398f35ff800dd553fe5933/test/undici/retry.js#L47 + let x = 0 + const server = createServer((req, res) => { + if (x === 0) { + t.deepStrictEqual(req.headers.range, 'bytes=0-3') + res.setHeader('etag', 'W/asd') + res.write('abc') + setTimeout(() => { + res.destroy() + }, 1e2) + } else if (x === 1) { + t.deepStrictEqual(req.headers.range, 'bytes=3-') + t.equal(req.headers['if-match'], undefined) + + res.setHeader('content-range', 'bytes 3-6/6') + res.setHeader('etag', 'W/efg') + res.statusCode = 206 + res.end('def') + } + x++ + }) + + const dispatchOptions = { + retryOptions: { + retry: function (err, _, done) { + counter++ + + if (err.code && err.code === 'UND_ERR_DESTROYED') { + return done(false) + } + + if (err.statusCode === 206) return done(err) + + setTimeout(done, 800) + } + }, + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json' + } + } + + server.listen(0, () => { + const client = new Client(`http://localhost:${server.address().port}`) + const handler = new RetryHandler(dispatchOptions, { + dispatch: (...args) => { + return client.dispatch(...args) + }, + handler: { + onRequestSent () { + t.ok(true, 'pass') + }, + onConnect () { + t.ok(true, 'pass') + }, + onBodySent () { + t.ok(true, 'pass') + }, + onHeaders (status, _rawHeaders, resume, _statusMessage) { + t.strictEqual(status, 200) + return true + }, + onData (chunk) { + chunks.push(chunk) + return true + }, + onComplete () { + t.strictEqual(Buffer.concat(chunks).toString('utf-8'), 'abcdef') + t.strictEqual(counter, 1) + }, + onError () { + t.fail() + } + } + }) + + client.dispatch( + { + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json', + Range: 'bytes=0-3' + } + }, + handler + ) + + after(async () => { + await client.close() + + server.close() + await once(server, 'close') + }) + }) + + await t.completed +}) From de76e4e254f18c6d8eff1580f6e3bb51fc266ebc Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Sun, 21 Apr 2024 14:23:13 +0200 Subject: [PATCH 2/5] feat: differentiate between weak and strong etags --- lib/handler/retry-handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index b9ec7f34ba2..b9f24ff151a 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -205,7 +205,7 @@ class RetryHandler { } // Let's start with a weak etag check - if (this.etag != null && this.etag !== headers.etag) { + if (this.etag != null && !this.isWeakEtag && this.etag !== headers.etag) { this.abort( new RequestRetryError('ETag mismatch', statusCode, { headers, From 8ee7656588f88511777bf2bdcde3904133f3b9f6 Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Thu, 25 Apr 2024 10:13:13 +0200 Subject: [PATCH 3/5] refactor: drop support for weak etags --- lib/handler/retry-handler.js | 12 ++-- test/retry-handler.js | 109 ++++++++++++++++++++++++++++++++++- 2 files changed, 115 insertions(+), 6 deletions(-) diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index b9f24ff151a..8f6d2a9e27f 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -64,7 +64,6 @@ class RetryHandler { this.start = 0 this.end = null this.etag = null - this.isWeakEtag = false this.resume = null // Handle possible onConnect duplication @@ -205,7 +204,7 @@ class RetryHandler { } // Let's start with a weak etag check - if (this.etag != null && !this.isWeakEtag && this.etag !== headers.etag) { + if (this.etag != null && this.etag !== headers.etag) { this.abort( new RequestRetryError('ETag mismatch', statusCode, { headers, @@ -264,8 +263,11 @@ class RetryHandler { this.resume = resume this.etag = headers.etag != null ? headers.etag : null - if (this.etag != null) { - this.isWeakEtag = this.etag.startsWith('W/') + // Weak etags are not useful for comparison nor cache + // for instance not safe to assume if the response is byte-per-byte + // equal + if (this.etag != null && this.etag.startsWith('W/')) { + this.etag = null } return this.handler.onHeaders( @@ -331,7 +333,7 @@ class RetryHandler { const headers = { range: `bytes=${this.start}-${this.end ?? ''}` } // Weak etag check - weak etags will make comparison algorithms never match - if (this.retryOpts.ifMatch && this.etag != null && !this.isWeakEtag) { + if (this.retryOpts.ifMatch && this.etag != null) { headers['if-match'] = this.etag } diff --git a/test/retry-handler.js b/test/retry-handler.js index 43608903974..08098594eee 100644 --- a/test/retry-handler.js +++ b/test/retry-handler.js @@ -1086,6 +1086,113 @@ test('Issue#3128 - Support if-match', async t => { await t.completed }) +test('Issue#3128 - Support if-match (disabled)', async t => { + t = tspl(t, { plan: 9 }) + + const chunks = [] + let counter = 0 + + // Took from: https://github.com/nxtedition/nxt-lib/blob/4b001ebc2f22cf735a398f35ff800dd553fe5933/test/undici/retry.js#L47 + let x = 0 + const server = createServer((req, res) => { + if (x === 0) { + t.deepStrictEqual(req.headers.range, 'bytes=0-3') + res.setHeader('etag', 'asd') + res.write('abc') + setTimeout(() => { + res.destroy() + }, 1e2) + } else if (x === 1) { + t.deepStrictEqual(req.headers.range, 'bytes=3-') + t.equal(req.headers['if-match'], undefined) + + res.setHeader('content-range', 'bytes 3-6/6') + res.setHeader('etag', 'asd') + res.statusCode = 206 + res.end('def') + } + x++ + }) + + const dispatchOptions = { + retryOptions: { + retry: function (err, _, done) { + counter++ + + if (err.code && err.code === 'UND_ERR_DESTROYED') { + return done(false) + } + + if (err.statusCode === 206) return done(err) + + setTimeout(done, 800) + }, + ifMatch: false + }, + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json' + } + } + + server.listen(0, () => { + const client = new Client(`http://localhost:${server.address().port}`) + const handler = new RetryHandler(dispatchOptions, { + dispatch: (...args) => { + return client.dispatch(...args) + }, + handler: { + onRequestSent () { + t.ok(true, 'pass') + }, + onConnect () { + t.ok(true, 'pass') + }, + onBodySent () { + t.ok(true, 'pass') + }, + onHeaders (status, _rawHeaders, resume, _statusMessage) { + t.strictEqual(status, 200) + return true + }, + onData (chunk) { + chunks.push(chunk) + return true + }, + onComplete () { + t.strictEqual(Buffer.concat(chunks).toString('utf-8'), 'abcdef') + t.strictEqual(counter, 1) + }, + onError () { + t.fail() + } + } + }) + + client.dispatch( + { + method: 'GET', + path: '/', + headers: { + 'content-type': 'application/json', + Range: 'bytes=0-3' + } + }, + handler + ) + + after(async () => { + await client.close() + + server.close() + await once(server, 'close') + }) + }) + + await t.completed +}) + test('Issue#3128 - Should ignore weak etags', async t => { t = tspl(t, { plan: 9 }) @@ -1192,7 +1299,7 @@ test('Issue#3128 - Should ignore weak etags', async t => { await t.completed }) -test('Weak etags are ignored on range-requests', { only: true }, async t => { +test('Weak etags are ignored on range-requests', async t => { t = tspl(t, { plan: 9 }) const chunks = [] From 917f5aea700e3e86d9b8f3b1ff6c3802394e5b59 Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Thu, 25 Apr 2024 10:17:04 +0200 Subject: [PATCH 4/5] docs: add documentation and types --- docs/docs/api/RetryHandler.md | 1 + test/types/retry-agent.test-d.ts | 2 +- types/retry-handler.d.ts | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/docs/api/RetryHandler.md b/docs/docs/api/RetryHandler.md index 6dbc5077d02..1d19448c62f 100644 --- a/docs/docs/api/RetryHandler.md +++ b/docs/docs/api/RetryHandler.md @@ -29,6 +29,7 @@ Extends: [`Dispatch.DispatchOptions`](Dispatcher.md#parameter-dispatchoptions). - **methods** `string[]` (optional) - Array of HTTP methods to retry. Default: `['GET', 'PUT', 'HEAD', 'OPTIONS', 'DELETE']` - **statusCodes** `number[]` (optional) - Array of HTTP status codes to retry. Default: `[429, 500, 502, 503, 504]` - **errorCodes** `string[]` (optional) - Array of Error codes to retry. Default: `['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'ENETDOWN','ENETUNREACH', 'EHOSTDOWN', 'UND_ERR_SOCKET']` +- **ifMatch** `boolean` (optional) - It enables the send of `if-match` pre-condition header if `etag` is present in the first response. Default: `true` **`RetryContext`** diff --git a/test/types/retry-agent.test-d.ts b/test/types/retry-agent.test-d.ts index 9177efd07ff..efc1c8c2e0c 100644 --- a/test/types/retry-agent.test-d.ts +++ b/test/types/retry-agent.test-d.ts @@ -4,7 +4,7 @@ import { RetryAgent, Agent } from '../..' const dispatcher = new Agent() expectAssignable(new RetryAgent(dispatcher)) -expectAssignable(new RetryAgent(dispatcher, { maxRetries: 5 })) +expectAssignable(new RetryAgent(dispatcher, { maxRetries: 5, ifMatch: false })) { const retryAgent = new RetryAgent(dispatcher) diff --git a/types/retry-handler.d.ts b/types/retry-handler.d.ts index e44b207c221..9abcca636d4 100644 --- a/types/retry-handler.d.ts +++ b/types/retry-handler.d.ts @@ -107,6 +107,13 @@ declare namespace RetryHandler { * @default [500, 502, 503, 504, 429], */ statusCodes?: number[]; + /** + * Enables/disabled the usage of `If-Match` pre-condition header for retry requests. + * @type {boolean} + * @memberof RetryOptions + * @default true + */ + ifMatch?: boolean; } export interface RetryHandlers { From 2b793459e18a2113e25fbf1e94ac5e3935e118c1 Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Thu, 25 Apr 2024 10:37:54 +0200 Subject: [PATCH 5/5] Revert "docs: add documentation and types" This reverts commit 917f5aea700e3e86d9b8f3b1ff6c3802394e5b59. --- docs/docs/api/RetryHandler.md | 1 - lib/handler/retry-handler.js | 4 +- test/retry-handler.js | 107 ------------------------------- test/types/retry-agent.test-d.ts | 2 +- types/retry-handler.d.ts | 7 -- 5 files changed, 2 insertions(+), 119 deletions(-) diff --git a/docs/docs/api/RetryHandler.md b/docs/docs/api/RetryHandler.md index 1d19448c62f..6dbc5077d02 100644 --- a/docs/docs/api/RetryHandler.md +++ b/docs/docs/api/RetryHandler.md @@ -29,7 +29,6 @@ Extends: [`Dispatch.DispatchOptions`](Dispatcher.md#parameter-dispatchoptions). - **methods** `string[]` (optional) - Array of HTTP methods to retry. Default: `['GET', 'PUT', 'HEAD', 'OPTIONS', 'DELETE']` - **statusCodes** `number[]` (optional) - Array of HTTP status codes to retry. Default: `[429, 500, 502, 503, 504]` - **errorCodes** `string[]` (optional) - Array of Error codes to retry. Default: `['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'ENETDOWN','ENETUNREACH', 'EHOSTDOWN', 'UND_ERR_SOCKET']` -- **ifMatch** `boolean` (optional) - It enables the send of `if-match` pre-condition header if `etag` is present in the first response. Default: `true` **`RetryContext`** diff --git a/lib/handler/retry-handler.js b/lib/handler/retry-handler.js index 8f6d2a9e27f..56ea4be79be 100644 --- a/lib/handler/retry-handler.js +++ b/lib/handler/retry-handler.js @@ -20,7 +20,6 @@ class RetryHandler { maxTimeout, minTimeout, timeoutFactor, - ifMatch, // Response scoped methods, errorCodes, @@ -35,7 +34,6 @@ class RetryHandler { this.aborted = false this.retryOpts = { retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry], - ifMatch: ifMatch ?? true, retryAfter: retryAfter ?? true, maxTimeout: maxTimeout ?? 30 * 1000, // 30s, minTimeout: minTimeout ?? 500, // .5s @@ -333,7 +331,7 @@ class RetryHandler { const headers = { range: `bytes=${this.start}-${this.end ?? ''}` } // Weak etag check - weak etags will make comparison algorithms never match - if (this.retryOpts.ifMatch && this.etag != null) { + if (this.etag != null) { headers['if-match'] = this.etag } diff --git a/test/retry-handler.js b/test/retry-handler.js index 08098594eee..8894ea86668 100644 --- a/test/retry-handler.js +++ b/test/retry-handler.js @@ -1086,113 +1086,6 @@ test('Issue#3128 - Support if-match', async t => { await t.completed }) -test('Issue#3128 - Support if-match (disabled)', async t => { - t = tspl(t, { plan: 9 }) - - const chunks = [] - let counter = 0 - - // Took from: https://github.com/nxtedition/nxt-lib/blob/4b001ebc2f22cf735a398f35ff800dd553fe5933/test/undici/retry.js#L47 - let x = 0 - const server = createServer((req, res) => { - if (x === 0) { - t.deepStrictEqual(req.headers.range, 'bytes=0-3') - res.setHeader('etag', 'asd') - res.write('abc') - setTimeout(() => { - res.destroy() - }, 1e2) - } else if (x === 1) { - t.deepStrictEqual(req.headers.range, 'bytes=3-') - t.equal(req.headers['if-match'], undefined) - - res.setHeader('content-range', 'bytes 3-6/6') - res.setHeader('etag', 'asd') - res.statusCode = 206 - res.end('def') - } - x++ - }) - - const dispatchOptions = { - retryOptions: { - retry: function (err, _, done) { - counter++ - - if (err.code && err.code === 'UND_ERR_DESTROYED') { - return done(false) - } - - if (err.statusCode === 206) return done(err) - - setTimeout(done, 800) - }, - ifMatch: false - }, - method: 'GET', - path: '/', - headers: { - 'content-type': 'application/json' - } - } - - server.listen(0, () => { - const client = new Client(`http://localhost:${server.address().port}`) - const handler = new RetryHandler(dispatchOptions, { - dispatch: (...args) => { - return client.dispatch(...args) - }, - handler: { - onRequestSent () { - t.ok(true, 'pass') - }, - onConnect () { - t.ok(true, 'pass') - }, - onBodySent () { - t.ok(true, 'pass') - }, - onHeaders (status, _rawHeaders, resume, _statusMessage) { - t.strictEqual(status, 200) - return true - }, - onData (chunk) { - chunks.push(chunk) - return true - }, - onComplete () { - t.strictEqual(Buffer.concat(chunks).toString('utf-8'), 'abcdef') - t.strictEqual(counter, 1) - }, - onError () { - t.fail() - } - } - }) - - client.dispatch( - { - method: 'GET', - path: '/', - headers: { - 'content-type': 'application/json', - Range: 'bytes=0-3' - } - }, - handler - ) - - after(async () => { - await client.close() - - server.close() - await once(server, 'close') - }) - }) - - await t.completed -}) - test('Issue#3128 - Should ignore weak etags', async t => { t = tspl(t, { plan: 9 }) diff --git a/test/types/retry-agent.test-d.ts b/test/types/retry-agent.test-d.ts index efc1c8c2e0c..9177efd07ff 100644 --- a/test/types/retry-agent.test-d.ts +++ b/test/types/retry-agent.test-d.ts @@ -4,7 +4,7 @@ import { RetryAgent, Agent } from '../..' const dispatcher = new Agent() expectAssignable(new RetryAgent(dispatcher)) -expectAssignable(new RetryAgent(dispatcher, { maxRetries: 5, ifMatch: false })) +expectAssignable(new RetryAgent(dispatcher, { maxRetries: 5 })) { const retryAgent = new RetryAgent(dispatcher) diff --git a/types/retry-handler.d.ts b/types/retry-handler.d.ts index 9abcca636d4..e44b207c221 100644 --- a/types/retry-handler.d.ts +++ b/types/retry-handler.d.ts @@ -107,13 +107,6 @@ declare namespace RetryHandler { * @default [500, 502, 503, 504, 429], */ statusCodes?: number[]; - /** - * Enables/disabled the usage of `If-Match` pre-condition header for retry requests. - * @type {boolean} - * @memberof RetryOptions - * @default true - */ - ifMatch?: boolean; } export interface RetryHandlers {