link_checker: Handle non-success status codes #897
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
can_fail_404_links()
test doesn't encounter a 404 response in actuality, since the google.comys domain doesn't resolve. When the test is updated such that the response's status code is a 404, the test fails because thecheck_url()
function doesn't handle non-success responses how the test's assertions expect. This commit updatescheck_url()
to handle non-success responses, treating them much like errors.If any (or all) of the non-success status code types (informational, redirection, client error, server error) should be handled in a different fashion, let me know. If
check_url()
's current behavior is correct, I'll get rid of these changes and update thecan_fail_404_links()
test instead.Either way, this will help with the forthcoming test changes related to HTTP mocking. I already have those changes finished (#898) but it will fail the
can_fail_404_links()
test until this is addressed.