Skip to content

assertPublicHttpUrl

function assertPublicHttpUrl(target: string): void;

Guard an address before fetching it. Only public web pages are ever wanted, so require http(s) and reject private, loopback, and link-local hosts.

Exported because a source that accepts an address from its own configuration should refuse a bad one when it is entered, not on the first sync.

ParameterTypeDescription
targetstringThe address about to be fetched.

void

Nothing; it throws when the target is not a public web page.