POST 提交
Content-Type:application/x-www-form-urlencoded
Accept:text/html,
如何获取响应头location
求指点
什么语言?要禁用自动跳转才能获取到location响应头。python如下
import requests
res = requests.post(url=url, headers=headers, data=data, allow_redirects=False) # 注 allow_redirects=False是必须的
print(res.headers[‘location’]) # 获取其他的也是一样
C#
var req = (HttpWebRequest)HttpWebRequest.Create("网址");
req.AllowAutoRedirect = false;
其他语言题主自己找下对应的配置。前端xhr对象无此类配置,获取不到location
获取请求头 javax.servlet.http.HttpServletRequest#getHeader
获取响应头 javax.servlet.http.HttpServletResponse#getHeader