update: 状态码判断完善,补充verify相关接口 #1783

This commit is contained in:
binaryify
2023-08-21 10:19:17 +08:00
parent 7f21fbcda1
commit 5a0bdfb171
5 changed files with 75 additions and 6 deletions
+8 -3
View File
@@ -147,11 +147,16 @@ const createRequest = (method, url, data = {}, options) => {
} else {
const purl = new URL(options.proxy)
if (purl.hostname) {
const agent = tunnel[purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp']({
const agent = tunnel[
purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp'
]({
proxy: {
host: purl.hostname,
port: purl.port || 80,
proxyAuth: purl.username && purl.password ? (purl.username + ':' + purl.password) : ''
proxyAuth:
purl.username && purl.password
? purl.username + ':' + purl.password
: '',
},
})
settings.httpsAgent = agent
@@ -183,7 +188,7 @@ const createRequest = (method, url, data = {}, options) => {
answer.body = body
}
answer.status = answer.body.code || res.status
answer.status = Number(answer.body.code || res.status)
if (
[201, 302, 400, 502, 800, 801, 802, 803].indexOf(answer.body.code) >
-1