当前位置:网站首页>Wechat applet request reported 400 error @ requestbody failed to receive

Wechat applet request reported 400 error @ requestbody failed to receive

2020-11-07 21:03:10 Maiyuweng

backstage springboot Do the interface , Parameter use @RequestBody JSONObject Pick up But the applet wx.request Visit tips 400, Backstage observation also reported a mistake , It's been posted backstage , After checking, it was found that it was a small program request By default get The way , Change to post backstage @RequestBody You can receive

wx.request({
    url: "api Address ", 
    data: {a:1,b:2},
    method: "POST",
    header: {
      'content-type': 'application/json'
    },
    success(res) {
      console.log(res.data)
    }
  })

版权声明
本文为[Maiyuweng]所创,转载请带上原文链接,感谢