Skip to content

Commit

Permalink
fix some false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
justindhillon committed Jan 20, 2024
1 parent 4355255 commit 0f32b87
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions checkLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ export async function checkLink(link: string): Promise<boolean> {
try {
await axios.head(link, params);
} catch (err: any) {
// Forbidden still means alive
if (err.response.status === 403) return false;

// If HEAD is not allowed try GET
if (err.response.status !== 405) return true;
try {
await axios.get(link, params);
} catch {
return true;
if (err.response.status === 405) {
try {
await axios.get(link, params);
} catch {
return true;
}
}
}

Expand Down

0 comments on commit 0f32b87

Please sign in to comment.