validateUrl
function validateUrl( value, path, options?): ValidationIssue[];Defined in: src/util/validation.ts:209
Check an absolute URL against a policy; returns the issues (empty when the URL is acceptable). Dangerous schemes are always rejected.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
path |
string |
options? |
UrlPolicyOptions |
Returns
Section titled “Returns”Example
Section titled “Example”// A webhook endpoint: https only (http on localhost), no credentials.validateUrl(url, "endpoint.url", { allowedSchemes: ["https:", "http:"], requireHttps: true, rejectCredentials: true,});