fix copy faults

This commit is contained in:
Nzix
2018-09-30 21:31:01 +08:00
parent 08b5d5af27
commit b84fb38a7d
6 changed files with 19 additions and 17 deletions
+5 -4
View File
@@ -48,8 +48,8 @@ function createRequest(method, url, data, options){
if(url.indexOf('music.163.com') != -1) headers['Referer'] = 'http://music.163.com'
const answer = {
code: 500,
body: {code: 500},
code: 502,
body: {code: 502},
cookie: []
}
@@ -57,7 +57,7 @@ function createRequest(method, url, data, options){
{method: method, url: url, headers: headers, body: queryString.stringify(data), proxy: options.proxy},
(err, res, body) => {
if(err){
answer.body = {code: 500, msg: err.stack}
answer.body = {code: 502, msg: err.stack}
reject(answer)
}
else{
@@ -70,9 +70,10 @@ function createRequest(method, url, data, options){
answer.body = body
answer.code = res.statusCode
}
answer.code = (answer.code < 100 || answer.code > 600) ? 400 : answer.code
if(answer.code == 200)
resolve(answer)
else
else
reject(answer)
}
}