Skip to content

Commit

Permalink
fix: trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoaldamav committed Jan 25, 2024
1 parent 14d9aa9 commit f1bff63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion network/agent/agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ test('select correct client certificates when host has a path', () => {
test('select correct client certificates when host has a path and the cert contains a path', () => {
const agent = getAgent('https://foo.com/bar/baz', {
clientCertificates: {
'//foo.com/bar': {
'//foo.com/bar/': {
ca: 'ca',
cert: 'cert',
key: 'key',
Expand Down
6 changes: 3 additions & 3 deletions network/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export function getAgent (uri: string, opts: AgentOptions) {
}

function getClientCertificates(uri: string, opts: AgentOptions) {
const { host, hostOnlyDomain, pathname } = parseUri(uri)
const { host, hostOnlyDomain, pathname, nerf } = parseUri(uri)

if (host.endsWith(pathname)) {
return opts.clientCertificates?.[host];
}

const fullPath = `${host}${pathname !== '/' ? pathname : ''}`;
return opts.clientCertificates?.[fullPath] ?? opts.clientCertificates?.[host] ?? opts.clientCertificates?.[hostOnlyDomain];
const fullPath = `${nerf}${pathname !== '/' ? pathname : ''}`;
return opts.clientCertificates?.[fullPath] ?? opts.clientCertificates?.[nerf] ?? opts.clientCertificates?.[hostOnlyDomain];
}

function getNonProxyAgent (uri: string, opts: AgentOptions) {
Expand Down

0 comments on commit f1bff63

Please sign in to comment.