@nxtedition/nxt-undici 2.0.10 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/interceptor/redirect.js +11 -15
- package/package.json +1 -1
|
@@ -42,21 +42,17 @@ class Handler {
|
|
|
42
42
|
|
|
43
43
|
this.count += 1
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (this.count >= maxCount) {
|
|
57
|
-
// TODO (perf): Consume body?
|
|
58
|
-
throw new Error(`Max redirections reached: ${maxCount}.`)
|
|
59
|
-
}
|
|
45
|
+
// TODO (feat): follow as function...
|
|
46
|
+
|
|
47
|
+
const maxCount = Number.isFinite(this.opts.follow)
|
|
48
|
+
? this.opts.follow
|
|
49
|
+
: Number.isFinite(this.opts.follow?.count)
|
|
50
|
+
? this.opts.follow?.count
|
|
51
|
+
: 0
|
|
52
|
+
|
|
53
|
+
if (this.count >= maxCount) {
|
|
54
|
+
// TODO (perf): Consume body?
|
|
55
|
+
throw new Error(`Max redirections reached: ${maxCount}.`)
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
if (isDisturbed(this.opts.body)) {
|