fix header

This commit is contained in:
Looly
2019-08-28 10:29:34 +08:00
parent 500be4aaba
commit 684bc1b6ae
3 changed files with 17 additions and 10 deletions

View File

@@ -37,6 +37,10 @@ public enum GlobalHeaders {
* @return this
*/
public GlobalHeaders putDefault(boolean isReset) {
// 解决HttpURLConnection中无法自定义Host等头信息的问题
// https://stackoverflow.com/questions/9096987/how-to-overwrite-http-header-host-in-a-httpurlconnection/9098440
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
if (isReset) {
this.headers.clear();
}