微信小程序发起请求失败的解决方法

来源:互联网 发布:危化品查询软件 编辑:程序博客网 时间:2024/06/07 04:54

微信小程序中wx.request是发起的是HTTPS 请求,其method有两种方法:get和post。

method为get时,header必须为:

header: {        'content-type': 'application/json'      },

method为post时,header必须为:

header: {      'content-type': 'application/x-www-form-urlencoded'      },

如果header错误会导致后台得不到数据而报NullPointerException错误




0 0
原创粉丝点击