收藏
回答

为什么 云函数 request 请求超时 不跳出?求大佬指点迷津

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)

                      });

                });

            },


最后一次编辑于  2020-12-03
回答关注问题邀请回答
收藏

2 个回答

  • 云开发技术运营专员-Zira
    云开发技术运营专员-Zira
    2020-12-03
    return new Promise((resolve, reject) => {
    	    request({
    	      url: `https`,
    	      method: 'GET'
    	    }, (error, response, body) => {
    	      if (error) {
    	        reject(error)
    	      }
    	      resolve()
    	    })
    	  })
    
    2020-12-03
    有用
    回复
  • 寄托思念
    寄托思念
    2020-12-03

    求大佬解答

    2020-12-03
    有用
    回复 3
登录 后发表内容
问题标签