位置头已经存在,我可以在浏览器中看到它:
我正在使用org.apache.httpcomponents.httpclient发送带有cookie的http请求:
```
![enter image description here](https://istack.dev59.com/BszBh.webp)
```
URI uri = new URIBuilder().setScheme("https").setHost("api.weibo.com").setPath("/oauth2/authorize").setParameter("client_id","3099336849").setParameter("redirect_uri","http://45.78.24.83/authorize").setParameter("response_type", "code").build();
HttpGet req1 = new HttpGet(uri);
RequestConfig config = RequestConfig.custom().setRedirectsEnabled(false).build();
req1.setConfig(config);
req1.setHeader("Connection", "keep-alive");
req1.setHeader("Cookie", cookie);
req1.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36");
response = httpclient.execute(req1);
我谷歌了很多,尝试启用/禁用自动重定向,但似乎对我没用。那么,有人能告诉我如何像浏览器一样获取响应中的位置标头吗?