小游戏request后没有response

发布于 7 年前作者 jiexue18683 次浏览最后编辑 7 年前来自 ask

已经设置好了合法域名(https的)

wx.request POST 时,request可以出去,在服务端也接收到了POST数据,但是客户端接收不到response,没有报错信息,有遇到类似问题的吗?

另,如果不校验域名,则可以正常进行网络请求。

以下为代码段

static getToken(param = { 

    url: String, 

    tempCode: String, 

    response: Function, 

    complete: Function

  }) {

    let isSuccess = false

    wx.request({

      url: param.url,

      data: {

        noncestr: Date.now(),

        code: param.tempCode

      },

      method: ‘POST’,

      success: (result) => {

        isSuccess = true

        if (typeof param.response === “function”) param.response(result.data)

      },

      complete: () => {

         if (typeof param.complete === ‘function’) param.complete(isSuccess)

         }

    })

  }

2 回复
izou
izou1 楼6 年前

我也遇到了这个问题,同样是在校验域名的情况下,真机体验是正常的,只有开发工具没有走到回调

ming31
ming312 楼6 年前

在wx.request的complete输出下返回内容看看咯