request请求数据在iphone没问题,安卓上请求不正确
发布于 6 年前 作者 hfang 5028 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

这个是真机调试下的安卓请求报头:

Provisional headers are shown
Accept-Encoding:gzip
charset:utf-8
Content-Length:0
content-type:application/x-www-form-urlencoded;charset=utf-8
referer:https://servicewechat.com/wxdb1e47106e7514d2/0/page-frame.html
User-Agent:Mozilla/5.0 (Linux; Android 8.0.0; SM-G9550 Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 MicroMessenger/7.0.3.1400(0x2700033B) Process/appbrand1 NetType/WIFI Language/zh_CN

下面这个是iphone的请求报头:

Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:0
content-type:application/x-www-form-urlencoded;charset=UTF-8
Host:www.ejlscm.com
Origin:http://127.0.0.1:55362
Pragma:no-cache
Referer:https://servicewechat.com/wxdb1e47106e7514d2/devtools/page-frame.html
User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1 wechatdevtools/1.02.1902010 MicroMessenger/6.7.3 Language/zh_CN webview/ token/2424d8daf5565c79c1e9e99271a5e300

后者正确就会返回302跳转到鉴权,前者不正确直接返回200了

  • 预期表现

期望两者行为能一致

  • 复现路径
  • 提供一个最简复现 Demo

// 这是我写的请求

export default async function loginRq(user, password) {
 
let option = {
   url: `https://www.ejlscm.com/user_login?username=${user}&password=${password}`,
    method: 'POST',
   header: {
        'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
    },
  }
 
   let response = await egRequest(option)
 
   const result = response || { status: 'Failed', data: '网络错误:请联系管理员!' }
 
   return result
 
}


1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

回到顶部