Skip to content

Commit 288c006

Browse files
committed
test: reuse shared hostname normalization
1 parent 1490d59 commit 288c006

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/test-helpers/ssrf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { vi } from "vitest";
2+
import { normalizeHostname } from "../infra/net/hostname.js";
23
import * as ssrf from "../infra/net/ssrf.js";
34
import type { LookupFn } from "../infra/net/ssrf.js";
4-
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
55

66
export function mockPinnedHostnameResolution(addresses: string[] = ["93.184.216.34"]) {
77
const resolvePinnedHostname = ssrf.resolvePinnedHostname;
88
const resolvePinnedHostnameWithPolicy = ssrf.resolvePinnedHostnameWithPolicy;
99
const lookupFn = (async (hostname: string, options?: { all?: boolean }) => {
10-
const normalized = normalizeLowercaseStringOrEmpty(hostname).replace(/\.$/, "");
10+
const normalized = normalizeHostname(hostname);
1111
const resolved = addresses.map((address) => ({
1212
address,
1313
family: address.includes(":") ? 6 : 4,

0 commit comments

Comments
 (0)