does-url-exist
Version:
Check if a URL exists by Sending a HEAD Request with cross-fetch
27 lines (22 loc) • 816 B
JavaScript
const test = require("ava");
const doesUrlExist = require("./does-url-exist");
test("check if invalid url exists", async t => {
const url = "ht://example.org";
const exists = await doesUrlExist({ debug: false, url });
t.false(exists);
});
test("check if google exists", async t => {
const url = "https://google.com";
const exists = await doesUrlExist({ url });
t.true(exists);
});
test("check if random url exists", async t => {
const url = "https://0823714081720489172304871230487123089473216756725348932479874";
const exists = await doesUrlExist({ url });
t.false(exists);
});
test("check if overview exists", async t => {
const url = "https://s3.amazonaws.com/geotiff.io/eu_pasture.tif.ovr";
const exists = await doesUrlExist({ url });
t.false(exists);
});