Skip to content

Commit 5559235

Browse files
authored
doc: remove unused parameter redirectionLimitReached (#4933)
1 parent a4e4b84 commit 5559235

6 files changed

Lines changed: 5 additions & 15 deletions

File tree

docs/docs/api/RedirectHandler.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
A class that handles redirection logic for HTTP requests.
44

5-
## `new RedirectHandler(dispatch, maxRedirections, opts, handler, redirectionLimitReached)`
5+
## `new RedirectHandler(dispatch, maxRedirections, opts, handler)`
66

77
Arguments:
88

99
- **dispatch** `function` - The dispatch function to be called after every retry.
1010
- **maxRedirections** `number` - Maximum number of redirections allowed.
1111
- **opts** `object` - Options for handling redirection.
1212
- **handler** `object` - An object containing handlers for different stages of the request lifecycle.
13-
- **redirectionLimitReached** `boolean` (default: `false`) - A flag that the implementer can provide to enable or disable the feature. If set to `false`, it indicates that the caller doesn't want to use the feature and prefers the old behavior.
1413

1514
Returns: `RedirectHandler`
1615

@@ -20,7 +19,6 @@ Returns: `RedirectHandler`
2019
- **maxRedirections** `number` (required) - Maximum number of redirections allowed.
2120
- **opts** `object` (required) - Options for handling redirection.
2221
- **handler** `object` (required) - Handlers for different stages of the request lifecycle.
23-
- **redirectionLimitReached** `boolean` (default: `false`) - A flag that the implementer can provide to enable or disable the feature. If set to `false`, it indicates that the caller doesn't want to use the feature and prefers the old behavior.
2422

2523
### Properties
2624

@@ -30,7 +28,6 @@ Returns: `RedirectHandler`
3028
- **maxRedirections** `number` - Maximum number of redirections allowed.
3129
- **handler** `object` - Handlers for different stages of the request lifecycle.
3230
- **history** `Array` - An array representing the history of URLs during redirection.
33-
- **redirectionLimitReached** `boolean` - Indicates whether the redirection limit has been reached.
3431

3532
### Methods
3633

test/interceptors/redirect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ for (const factory of [
445445
await t.completed
446446
})
447447

448-
test('should follow a redirect chain up to the allowed number of times for redirectionLimitReached', async t => {
448+
test('should throw when max redirections is reached and throwOnMaxRedirect is enabled', async t => {
449449
t = tspl(t, { plan: 1 })
450450

451451
const server = await startRedirectingServer()

test/redirect-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ for (const factory of [
406406
await t.completed
407407
})
408408

409-
test('should follow a redirect chain up to the allowed number of times for redirectionLimitReached', async t => {
409+
test('should throw when max redirections is reached and throwOnMaxRedirect is enabled', async t => {
410410
t = tspl(t, { plan: 1 })
411411

412412
const server = await startRedirectingServer()

test/types/index.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const handler: Dispatcher.DispatchHandler = {}
4242

4343
const redirectHandler = new Undici.RedirectHandler(dispatcher.dispatch, 10, {
4444
path: '/', method: 'GET'
45-
}, handler, false) as RedirectHandler
45+
}, handler) as RedirectHandler
4646
expectAssignable<RedirectHandler>(redirectHandler)
4747

4848
expectType<() => void>(install)

types/dispatcher.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ declare namespace Dispatcher {
137137
signal?: AbortSignal | EventEmitter | null;
138138
/** This argument parameter is passed through to `ConnectData` */
139139
opaque?: TOpaque;
140-
/** Default: false */
141-
redirectionLimitReached?: boolean;
142140
/** Default: `null` */
143141
responseHeaders?: 'raw' | null;
144142
}
@@ -147,8 +145,6 @@ declare namespace Dispatcher {
147145
opaque?: TOpaque;
148146
/** Default: `null` */
149147
signal?: AbortSignal | EventEmitter | null;
150-
/** Default: false */
151-
redirectionLimitReached?: boolean;
152148
/** Default: `null` */
153149
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
154150
/** Default: `null` */
@@ -170,8 +166,6 @@ declare namespace Dispatcher {
170166
protocol?: string;
171167
/** Default: `null` */
172168
signal?: AbortSignal | EventEmitter | null;
173-
/** Default: false */
174-
redirectionLimitReached?: boolean;
175169
/** Default: `null` */
176170
responseHeaders?: 'raw' | null;
177171
}

types/handlers.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ export declare class RedirectHandler implements Dispatcher.DispatchHandler {
55
dispatch: Dispatcher.Dispatch,
66
maxRedirections: number,
77
opts: Dispatcher.DispatchOptions,
8-
handler: Dispatcher.DispatchHandler,
9-
redirectionLimitReached: boolean
8+
handler: Dispatcher.DispatchHandler
109
)
1110
}
1211

0 commit comments

Comments
 (0)