xox419
xox419
  • 发布:2022-09-14 18:15
  • 更新:2022-12-29 11:28
  • 阅读:200

httpProxyForEip.get().then() 没有这个方法吗

分类:uniCloud

httpProxyForEip方式请求返回的是一个JSON字符串, uniCloud.httpclient.request返回的是一个JSON对象

// then后面就不执行了    
uniCloud.httpProxyForEip.get(  
                url,  
                params  
              ).then(function(res) {  
                  console.log('res', res)  
              })  

 // 原来的HTTP请求then是可以执行  
    uniCloud.httpclient.request(url, {  
        method: 'GET',  
        data: params,  
        contentType: 'json', // 指定以application/json发送data内的数据  
        dataType: 'json' // 指定返回值为json格式,自动进行parse  
      }).then(function(res) {  
          console.log("request.res", res)  
      })
2022-09-14 18:15 负责人:无 分享
已邀请:
DCloud_uniCloud_CRL

DCloud_uniCloud_CRL

如果在云函数中使用then,可能无法等待httpProxyForEip.get执行完成云函数就销毁了,使用 await 试下。如果还有报错,把报错信息贴上来。

要回复问题请先登录注册