wx.request的POST方法的参数传输服务器接收不到的bug

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

wx.request方法的method参数为POST时,我在data传输的参数传输不到服务器。

1 回复
xqiao
xqiao1 楼6 年前

wx.request post 的 content-type 默认为 ‘application/json’

如果服务器没有用到 json 解释的话,可以把 content-type 设置回 urlencoded

wx.request({
  ....
  method: "POST",
  header: {
    "content-type": "application/x-www-form-urlencoded"
  },
  ...
})