@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.
@@ -42,21 +42,17 @@ class Handler {
42
42
 
43
43
  this.count += 1
44
44
 
45
- if (typeof this.opts.follow === 'function') {
46
- if (!this.opts.follow(location, this.count)) {
47
- return this.handler.onHeaders(statusCode, headers, resume, statusText)
48
- }
49
- } else {
50
- const maxCount = Number.isFinite(this.opts.follow)
51
- ? this.opts.follow
52
- : Number.isFinite(this.opts.follow?.count)
53
- ? this.opts.follow?.count
54
- : 0
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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",