hdoc-tools 0.24.0 → 0.25.0
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/hdoc-module.js +10 -2
- package/hdoc-validate.js +10 -2
- package/package.json +1 -1
package/hdoc-module.js
CHANGED
@@ -20,8 +20,16 @@
|
|
20
20
|
axiosRetry(axios, {
|
21
21
|
retries: 5,
|
22
22
|
shouldResetTimeout: true,
|
23
|
-
retryCondition
|
24
|
-
|
23
|
+
retryCondition(error) {
|
24
|
+
if (error.response && error.response.status) {
|
25
|
+
if (error.response.status >= 400 && error.response.status !== 401 && error.response.status !== 403) {
|
26
|
+
return true;
|
27
|
+
} else {
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
} else {
|
31
|
+
return false;
|
32
|
+
}
|
25
33
|
},
|
26
34
|
onRetry: (retryCount, error, requestConfig) => {
|
27
35
|
retried = true;
|
package/hdoc-validate.js
CHANGED
@@ -511,12 +511,20 @@ const e = require("express");
|
|
511
511
|
}
|
512
512
|
|
513
513
|
try {
|
514
|
-
await axios
|
514
|
+
await axios({
|
515
|
+
url: links[i],
|
516
|
+
method: 'get',
|
517
|
+
timeout: 10000,
|
518
|
+
maxRedirects: 0,
|
519
|
+
validateStatus: (status) =>
|
520
|
+
status >= 200 && status < 400,
|
521
|
+
})
|
522
|
+
|
515
523
|
messages[htmlFile.relativePath].push(
|
516
524
|
`Link is a valid external URL: ${links[i]}`,
|
517
525
|
);
|
518
526
|
} catch (e) {
|
519
|
-
const error_message = processErrorMessage(`
|
527
|
+
const error_message = processErrorMessage(`Issue with external link: ${e} - ${links[i]}`, markdown_path, markdown_content, links[i]);
|
520
528
|
errors[htmlFile.relativePath].push(error_message);
|
521
529
|
}
|
522
530
|
}
|