API reference › @evolu/common › Type › HttpUrl
type HttpUrl = string & Brand<"Url"> & Brand<"HttpUrl">;
Defined in: packages/common/src/Type.ts:9817
Url with the http: or https: scheme, such as a link to a web page.
Use it for links, because Url also accepts schemes such as javascript:,
whose links run code when followed. Evolu does not validate the values other
devices write, and anyone who can write to an owner, such as a collaborator,
can store any string, so transform a link read from the database with
HttpUrlFromString before rendering or opening it. Like Url, HttpUrl
does not normalize; use HttpUrlFromString to convert other spellings.
Example
import { assertErr, assertOk, HttpUrl } from "@evolu/common";
assertOk(HttpUrl.fromUnknown("https://example.com/"), "https://example.com/");
assertErr(HttpUrl.fromUnknown("javascript:alert(1)"), {
type: "HttpUrl",
value: "javascript:alert(1)",
});