originMatches()
The pure origin matcher behind the webclient wire’s inbound validation and the configured-origin check. No side effects; safe to use in your own origin logic.
1. Signature
originMatches(expected: string, actual: string): boolean;
Returns false for an empty expected and for "*" (which is never
accepted).
2. Matching rules
| Case | Behavior |
|---|---|
File-origin group |
The string |
Both are URLs |
Parsed with |
Not both URLs |
Fallback: exact string equality. |
3. Example
originMatches('https://enaio.example.com', 'https://enaio.example.com'); // true
originMatches('https://enaio.example.com', 'https://other.example.com'); // false
originMatches('null', 'file://'); // true (same origin group)
originMatches('file://', 'null'); // true (bidirectional)
originMatches('*', 'https://enaio.example.com'); // false — never accepted
See also WebclientWire (where the matcher
is applied) and the origin guide (where the
configured value comes from).