diff --git a/.changeset/plenty-spoons-repair.md b/.changeset/plenty-spoons-repair.md new file mode 100644 index 00000000..2ae47445 --- /dev/null +++ b/.changeset/plenty-spoons-repair.md @@ -0,0 +1,6 @@ +--- +'proxy-agent': patch +'pac-proxy-agent': patch +--- + +Fix `pac+` prefixed protocol URIs diff --git a/packages/pac-proxy-agent/src/index.ts b/packages/pac-proxy-agent/src/index.ts index 6ebdb6a9..8bf869cb 100644 --- a/packages/pac-proxy-agent/src/index.ts +++ b/packages/pac-proxy-agent/src/index.ts @@ -55,12 +55,12 @@ export type PacProxyAgentOptions = http.AgentOptions & * - "pac+https", "https" - refers to an HTTPS endpoint */ export class PacProxyAgent extends Agent { - static readonly protocols: `pac-${Protocols}`[] = [ - 'pac-data', - 'pac-file', - 'pac-ftp', - 'pac-http', - 'pac-https', + static readonly protocols: `pac+${Protocols}`[] = [ + 'pac+data', + 'pac+file', + 'pac+ftp', + 'pac+http', + 'pac+https', ]; uri: URL; diff --git a/packages/pac-proxy-agent/test/test.ts b/packages/pac-proxy-agent/test/test.ts index 80e97660..6886a8c1 100644 --- a/packages/pac-proxy-agent/test/test.ts +++ b/packages/pac-proxy-agent/test/test.ts @@ -280,7 +280,7 @@ describe('PacProxyAgent', () => { return 'HTTPS localhost:PORT;'; } - const uri = `data:,${encodeURIComponent( + const uri = `pac+data:,${encodeURIComponent( FindProxyForURL.toString().replace( 'PORT', proxyHttpsServerUrl.port diff --git a/packages/proxy-agent/src/index.ts b/packages/proxy-agent/src/index.ts index 0e72f2ef..98a6b22e 100644 --- a/packages/proxy-agent/src/index.ts +++ b/packages/proxy-agent/src/index.ts @@ -36,11 +36,11 @@ export const proxies: { socks4a: [SocksProxyAgent, SocksProxyAgent], socks5: [SocksProxyAgent, SocksProxyAgent], socks5h: [SocksProxyAgent, SocksProxyAgent], - 'pac-data': [PacProxyAgent, PacProxyAgent], - 'pac-file': [PacProxyAgent, PacProxyAgent], - 'pac-ftp': [PacProxyAgent, PacProxyAgent], - 'pac-http': [PacProxyAgent, PacProxyAgent], - 'pac-https': [PacProxyAgent, PacProxyAgent], + 'pac+data': [PacProxyAgent, PacProxyAgent], + 'pac+file': [PacProxyAgent, PacProxyAgent], + 'pac+ftp': [PacProxyAgent, PacProxyAgent], + 'pac+http': [PacProxyAgent, PacProxyAgent], + 'pac+https': [PacProxyAgent, PacProxyAgent], }; function isValidProtocol(v: string): v is ValidProtocol {