mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-22 23:51:23 +08:00
update: 状态码判断完善,补充verify相关接口 #1783
This commit is contained in:
+8
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user