mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -15,6 +15,8 @@ package org.dromara.hutool.http.client.engine.jdk;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.io.IoUtil;
|
||||
import org.dromara.hutool.core.io.stream.EmptyInputStream;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import org.dromara.hutool.http.HttpException;
|
||||
import org.dromara.hutool.http.HttpUtil;
|
||||
@@ -94,7 +96,11 @@ public class JdkHttpResponse implements Response, Closeable {
|
||||
|
||||
@Override
|
||||
public String header(final String name) {
|
||||
final List<String> headerValues = this.headers.get(name);
|
||||
List<String> headerValues = this.headers.get(name);
|
||||
if(null == headerValues){
|
||||
// issue#I96U4T,根据RFC2616规范,header的name不区分大小写
|
||||
headerValues = MapUtil.firstMatchValue(this.headers, entry-> StrUtil.equalsIgnoreCase(name, entry.getKey()));
|
||||
}
|
||||
if (ArrayUtil.isNotEmpty(headerValues)) {
|
||||
return headerValues.get(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user