From 48185aab773cff8c09bfa7003f89cdec1ad8aa76 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Thu, 18 Jan 2024 21:20:26 +0100 Subject: [PATCH] style: update --- network/agent/agent.ts | 6 +++--- network/proxy-agent/proxy-agent.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/network/agent/agent.ts b/network/agent/agent.ts index 4a37f98..512b9ae 100644 --- a/network/agent/agent.ts +++ b/network/agent/agent.ts @@ -14,7 +14,7 @@ export type AgentOptions = ProxyAgentOptions & { noProxy?: boolean | string } -export function getAgent(uri: string, opts: AgentOptions) { +export function getAgent (uri: string, opts: AgentOptions) { if ((opts.httpProxy || opts.httpsProxy) && !checkNoProxy(uri, opts)) { const proxyAgent = getProxyAgent(uri, opts) if (proxyAgent) return proxyAgent @@ -22,7 +22,7 @@ export function getAgent(uri: string, opts: AgentOptions) { return getNonProxyAgent(uri, opts) } -function getNonProxyAgent(uri: string, opts: AgentOptions) { +function getNonProxyAgent (uri: string, opts: AgentOptions) { const parsedUri = new URL(uri) const host = nerfDart(uri) const isHttps = parsedUri.protocol === 'https:' @@ -87,7 +87,7 @@ function getNonProxyAgent(uri: string, opts: AgentOptions) { return agent } -function checkNoProxy(uri: string, opts: { noProxy?: boolean | string }) { +function checkNoProxy (uri: string, opts: { noProxy?: boolean | string }) { const host = new URL(uri).hostname .split('.') .filter(x => x) diff --git a/network/proxy-agent/proxy-agent.ts b/network/proxy-agent/proxy-agent.ts index d716a4c..7cbca56 100644 --- a/network/proxy-agent/proxy-agent.ts +++ b/network/proxy-agent/proxy-agent.ts @@ -28,7 +28,7 @@ export interface ProxyAgentOptions { } } -export function getProxyAgent(uri: string, opts: ProxyAgentOptions) { +export function getProxyAgent (uri: string, opts: ProxyAgentOptions) { const parsedUri = new URL(uri) const pxuri = getProxyUri(parsedUri, opts) if (!pxuri) return @@ -56,7 +56,7 @@ export function getProxyAgent(uri: string, opts: ProxyAgentOptions) { return proxy } -function getProxyUri( +function getProxyUri ( uri: URL, opts: { httpProxy?: string @@ -98,7 +98,7 @@ function getProxyUri( } } -function getProxy( +function getProxy ( proxyUrl: URL, opts: { ca?: string | string[] @@ -142,7 +142,7 @@ function getProxy( return undefined } -function getAuth(user: { username?: string; password?: string }) { +function getAuth (user: { username?: string; password?: string }) { if (!user.username) { return undefined } @@ -157,13 +157,13 @@ const extraOpts = Symbol('extra agent opts') // This is a workaround for this issue: https://github.com/TooTallNate/node-https-proxy-agent/issues/89 class PatchedHttpsProxyAgent extends HttpsProxyAgent { - constructor(opts: any) { + constructor (opts: any) { super(opts) this[extraOpts] = opts } - callback(req: any, opts: any) { + callback (req: any, opts: any) { return super.callback(req, { ...this[extraOpts], ...opts }) } }