reachable-url 2.1.1 → 2.1.2
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/index.js +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -126,16 +126,16 @@ const reachableUrl = async (url, { maxBody = 0, ...opts } = {}) => {
|
|
|
126
126
|
redirectStatusCodes.push(res.statusCode)
|
|
127
127
|
})
|
|
128
128
|
|
|
129
|
+
// An `afterResponse` retry resolves with the final response without emitting
|
|
130
|
+
// another outer `response` event, so the promise result supersedes the
|
|
131
|
+
// listener's. The error carries one when nothing else did, as MaxRedirects does.
|
|
129
132
|
let errorResponse
|
|
130
133
|
try {
|
|
131
|
-
await req
|
|
134
|
+
response = await req
|
|
132
135
|
} catch (error) {
|
|
133
136
|
errorResponse = error.response
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
// A retried or cancelled request settles with the attempt before it, whose body
|
|
137
|
-
// is not this response's, so a response we saw outranks the error's. The error
|
|
138
|
-
// still carries one when nothing else did, as MaxRedirects does.
|
|
139
139
|
const resolvedResponse = toResponse(response ?? errorResponse)
|
|
140
140
|
|
|
141
141
|
if (resolvedResponse.statusCode === 206) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "reachable-url",
|
|
3
3
|
"description": "Resolve a URL as fast as possible and report whether the destination is reachable over HTTP.",
|
|
4
4
|
"homepage": "https://github.com/Kikobeats/reachable-url",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.2",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "josefrancisco.verdu@gmail.com",
|