Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
fix parameters error
Browse files Browse the repository at this point in the history
  • Loading branch information
YXL76 committed Oct 1, 2020
1 parent 8b529e5 commit cea2024
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions util/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const encrypt = require('./crypto')
const axios = require('axios')
const queryString = require('querystring')
const PacProxyAgent = require('pac-proxy-agent')
const zlib = require('zlib')
const http = require('http')
const https = require('https')

Expand Down Expand Up @@ -137,37 +136,14 @@ const createRequest = (method, url, data, options) => {
x.replace(/\s*Domain=[^(;|$)]+;*/, ''),
)
try {
if (options.crypto === 'eapi') {
zlib.unzip(body, function (err, buffer) {
const _buffer = err ? body : buffer
try {
try {
answer.body = JSON.parse(encrypt.decrypt(_buffer).toString())
answer.status = answer.body.code || res.statusCode
} catch (e) {
answer.body = JSON.parse(_buffer.toString())
answer.status = res.statusCode
}
} catch (e) {
answer.body = _buffer.toString()
answer.status = res.statusCode
}
answer.status =
100 < answer.status && answer.status < 600 ? answer.status : 400
if (answer.status === 200) resolve(answer)
else reject(answer)
})
return false
} else {
answer.body = JSON.parse(body)
answer.status = answer.body.code || res.statusCode
if (answer.body.code === 502) {
answer.status = 200
}
answer.body = body
answer.status = answer.body.code || res.status
if (answer.body.code === 502) {
answer.status = 200
}
} catch (e) {
answer.body = body
answer.status = res.statusCode
answer.status = res.status
}

answer.status =
Expand Down

0 comments on commit cea2024

Please sign in to comment.