HttpURLConnection设置host请求头无效
由于业务需要在调用第三方SDK时需要设置host请求头为对方的域名,在测试时发现代码设置后依然无法生效。...Access-Control-Request-Method",
"Connection", /* close is allowed */
"Content-Length",
//"Cookie...",
//"Cookie2",
"Content-Transfer-Encoding",
//"Date",
"Expect",
"Host",
"Keep-Alive...Transfer-Encoding",
"Upgrade",
//"User-Agent",
"Via"
};
allowRestrictedHeaders = ((Boolean)java.security.AccessController.doPrivileged...设置Host 头部无效
如何在HttpURLConnection中覆盖http-header"Host"?