Open karlhorky opened 3 years ago
A redirect can often indicate an architectural change of a website, that may lead to broken links later.
Would you be open for adding an option that would fail on redirects?
It would also support this feature in remark-lint-no-dead-urls, which depends on check-links. See further discussion here: https://github.com/davidtheclark/remark-lint-no-dead-urls/issues/15
remark-lint-no-dead-urls
check-links
It won't be as easy as passing in followRedirect: false to got unfortunately, because got still resolves the promise when it encounters a redirect with that option set to false:
followRedirect: false
got
false
Further reading: https://github.com/davidtheclark/remark-lint-no-dead-urls/issues/15#issuecomment-735223848
I guess probably a potential solution would be to check in the fetchHEAD and fetchGET resolver functions if the res.statusCode is in the 3xx range (if the failOnRedirect option is set).
fetchHEAD
fetchGET
res.statusCode
failOnRedirect
A redirect can often indicate an architectural change of a website, that may lead to broken links later.
Would you be open for adding an option that would fail on redirects?
It would also support this feature in
remark-lint-no-dead-urls
, which depends oncheck-links
. See further discussion here: https://github.com/davidtheclark/remark-lint-no-dead-urls/issues/15It won't be as easy as passing in
followRedirect: false
togot
unfortunately, becausegot
still resolves the promise when it encounters a redirect with that option set tofalse
:Further reading: https://github.com/davidtheclark/remark-lint-no-dead-urls/issues/15#issuecomment-735223848
I guess probably a potential solution would be to check in the
fetchHEAD
andfetchGET
resolver functions if theres.statusCode
is in the 3xx range (if thefailOnRedirect
option is set).