@nxtedition/nxt-undici 2.0.38 → 2.0.39
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.
|
@@ -17,6 +17,7 @@ class Handler {
|
|
|
17
17
|
|
|
18
18
|
this.count = 0
|
|
19
19
|
this.location = null
|
|
20
|
+
this.history = []
|
|
20
21
|
|
|
21
22
|
this.handler.onConnect((reason) => {
|
|
22
23
|
this.aborted = true
|
|
@@ -57,6 +58,7 @@ class Handler {
|
|
|
57
58
|
throw new Error(`Missing redirection location .`)
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
this.history.push(this.location)
|
|
60
62
|
this.count += 1
|
|
61
63
|
|
|
62
64
|
if (typeof this.opts.follow === 'function') {
|
|
@@ -67,7 +69,9 @@ class Handler {
|
|
|
67
69
|
}
|
|
68
70
|
} else {
|
|
69
71
|
if (this.count >= this.maxCount) {
|
|
70
|
-
throw new Error(`Max redirections reached: ${this.maxCount}.`)
|
|
72
|
+
throw Object.assign(new Error(`Max redirections reached: ${this.maxCount}.`), {
|
|
73
|
+
history: this.history,
|
|
74
|
+
})
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
|