Feature: migrate from aws-sdk v2 to v3

This commit is contained in:
萌萌哒赫萝
2023-08-08 20:34:19 -07:00
parent 76e588b2ef
commit 13852a5c1b
10 changed files with 557 additions and 573 deletions
+9 -10
View File
@@ -134,7 +134,7 @@ export interface IHTTPProxy {
}
export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'string'): IHTTPProxy | undefined | string => {
if (proxy === undefined || proxy === '') return undefined
if (!proxy) return undefined
if (/^https?:\/\//.test(proxy)) {
const { protocol, hostname, port } = new URL(proxy)
return type === 'string'
@@ -144,16 +144,15 @@ export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'str
port: Number(port),
protocol: protocol.slice(0, -1)
}
} else {
const [host, port] = proxy.split(':')
return type === 'string'
? `http://${host}:${port}`
: {
host,
port: port ? Number(port) : 80,
protocol: 'http'
}
}
const [host, port] = proxy.split(':')
return type === 'string'
? `http://${host}:${port}`
: {
host,
port: port ? Number(port) : 80,
protocol: 'http'
}
}
export const svg = `