mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-03 22:52:08 +08:00
modify callback data format
This commit is contained in:
parent
a37c34092f
commit
2bcccd46df
@ -64,14 +64,14 @@ function createRequest(method, url, data, options){
|
|||||||
answer.cookie = (res.headers['set-cookie'] || []).map(x => x.replace(/\s*Domain=[^(;|$)]+;*/, ''))
|
answer.cookie = (res.headers['set-cookie'] || []).map(x => x.replace(/\s*Domain=[^(;|$)]+;*/, ''))
|
||||||
try{
|
try{
|
||||||
answer.body = JSON.parse(body)
|
answer.body = JSON.parse(body)
|
||||||
answer.code = answer.body.code || res.statusCode
|
answer.status = answer.body.code || res.statusCode
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
answer.body = body
|
answer.body = body
|
||||||
answer.code = res.statusCode
|
answer.status = res.statusCode
|
||||||
}
|
}
|
||||||
answer.code = (answer.code < 100 || answer.code > 600) ? 400 : answer.code
|
answer.status = (100 < answer.status && answer.status < 600) ? answer.status : 400
|
||||||
if(answer.code == 200)
|
if(answer.status == 200)
|
||||||
resolve(answer)
|
resolve(answer)
|
||||||
else
|
else
|
||||||
reject(answer)
|
reject(answer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user