forked from gzzfw/backEnd/gz-dyh

xusd
2024-09-13 a1e2570096a99c127d2bb75c9e4bac99a78aa5e0
dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/HttpClientUtils.java
@@ -1,5 +1,6 @@
package cn.huge.base.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
@@ -34,6 +35,7 @@
 * @time: 2021-11-05 16:51:48
 * @version: 1.0.0
 */
@Slf4j
public class HttpClientUtils {
    /**
@@ -93,7 +95,6 @@
        }
        CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
        HttpPost httpost = new HttpPost(url);
        //设置header
        if (ObjectUtils.isNotEmpty(headers)) {
            for (Map.Entry<String, String> entry : headers.entrySet()) {
@@ -102,6 +103,7 @@
        }
        //组织请求参数
        List<NameValuePair> paramList = new ArrayList <NameValuePair>();
        if(ObjectUtils.isNotEmpty(params)){
            Set<String> keySet = params.keySet();
            for(String key : keySet) {
@@ -126,6 +128,7 @@
                httpResponse.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {  //关闭连接、释放资源