Improve URL checks to reduce false-negatives
This commit improves the URL health checking mechanism to reduce false negatives. - Treat all 2XX status codes as successful, addressing issues with codes like `204`. - Exclude URLs within Markdown inline code blocks. - Send the Host header for improved handling of webpages behind proxies. - Improve formatting and context for output messages. - Fix the defaulting options for redirects and cookie handling. - Add URL exclusion support for non-responsive URLs. - Update the user agent pool to modern browsers and platforms. - Improve CI/CD workflow to respond to modifications in the `test/checks/external-urls` directory, offering immediate feedback on potential impacts to the external URL test. - Add support for randomizing TLS fingerprint to mimic various clients better, improving the effectiveness of checks. However, this is not fully supported by Node.js's HTTP client; see nodejs/undici#1983 for more details. - Use `AbortSignal` instead of `AbortController` as more modern and simpler way to handle timeouts.
This commit is contained in:
19
tests/checks/external-urls/StatusChecker/UrlStatus.ts
Normal file
19
tests/checks/external-urls/StatusChecker/UrlStatus.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { indentText } from '@tests/shared/Text';
|
||||
|
||||
export interface UrlStatus {
|
||||
readonly url: string;
|
||||
readonly error?: string;
|
||||
readonly code?: number;
|
||||
}
|
||||
|
||||
export function formatUrlStatus(status: UrlStatus): string {
|
||||
return [
|
||||
`URL: ${status.url}`,
|
||||
...status.code !== undefined ? [
|
||||
`Response code: ${status.code}`,
|
||||
] : [],
|
||||
...status.error ? [
|
||||
`Error:\n${indentText(status.error)}`,
|
||||
] : [],
|
||||
].join('\n');
|
||||
}
|
||||
Reference in New Issue
Block a user