ifeilong / feilong

让Java开发更简便的工具库
Apache License 2.0
118 stars 30 forks source link

com.feilong.net.http.HttpClientUtil.getHttpFullInfo(HttpRequest, ConnectionConfig) 要支持自定义返回值类型转换 #755

Open venusdrogon opened 2 hours ago

venusdrogon commented 2 hours ago

com.feilong.net.http.HttpClientUtil.getHttpFullInfo(HttpRequest, ConnectionConfig) 要支持自定义返回值类型转换

venusdrogon commented 2 hours ago
    private static GuangdianHttpFullInfo pushData(String logKey,String requestJsonString){
        HttpFullInfo httpFullInfo = postAction(requestJsonString);

        //如果有异常
        if (null != httpFullInfo.getUncheckedHttpException()){
            return toGuangdianHttpFullInfo(httpFullInfo);
        }

        //---------------------------------------------------------------
        HttpResponse httpResponse = httpFullInfo.getHttpResponse();

        log.info(
                 "logKey:[{}] requestJsonString:[{}] httpResponse:[{}]",
                 logKey,
                 JsonUtil.format(requestJsonString),
                 JsonUtil.format(httpResponse));
        //---------------------------------------------------------------
        GuangdianHttpFullInfo guangdianHttpFullInfo = toGuangdianHttpFullInfo(httpFullInfo);
        guangdianHttpFullInfo.setGuangdianResponse(responseToBean(logKey, httpResponse.getResultString()));
        return guangdianHttpFullInfo;
    }