Skip to content

Commit

Permalink
revert: use runtime-agnostic domainToASCII
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhsf committed Jan 8, 2025
1 parent 943e4be commit 2ff5218
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/cookie/canonicalDomain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { IP_V6_REGEX_OBJECT } from './constants'
import type { Nullable } from '../utils'
import { domainToASCII } from 'node:url'

/**
* Normalizes a domain to lowercase and punycode-encoded.
* Runtime-agnostic equivalent to node's `domainToASCII`.
* @see https://nodejs.org/docs/latest-v22.x/api/url.html#urldomaintoasciidomain
*/
function domainToASCII(domain: string): string {
return new URL(`http://${domain}`).hostname
}

/**
* Transforms a domain name into a canonical domain name. The canonical domain name is a domain name
Expand Down

0 comments on commit 2ff5218

Please sign in to comment.