Skip to content

Commit

Permalink
Merge pull request #480 from salesforce/wjh/revert-domain-to-ascii
Browse files Browse the repository at this point in the history
revert: use runtime-agnostic `domainToASCII`
  • Loading branch information
colincasey authored Jan 9, 2025
2 parents b407f60 + 58a5e7e commit 80cf3c9
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 80cf3c9

Please sign in to comment.