query: function(queryObj) {
return new Promise(function(resolve, reject) {
request({
url: obj.url,
method: 'POST',
json: true,
body: {
query: queryObj.query,
variables: queryObj.variables
},
headers: queryObj.header || header,
timeout: 5000
}).then(function (res) {
//resolve(res)
console.log(timeout)
console.log('进入结果判断')
console.log(res)
responseHandler(resolve, reject, res,obj.errorHandler)
}).catch(function (err) {
console.log('请求失败')
reject(err)
});
});
},
return new Promise((resolve, reject) => { request({ url: `https`, method: 'GET' }, (error, response, body) => { if (error) { reject(error) } resolve() }) })
求大佬解答