package org.jeecg.config;

import cn.hutool.http.GlobalInterceptor;
import cn.hutool.http.HttpGlobalConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Slf4j
@Configuration
public class HutoolConfiguration {

    @PostConstruct
    public void httpConfig(){
        // 设置hutool HttpUtil的request请求参数打印
//        GlobalInterceptor.INSTANCE.addRequestInterceptor(httpObj -> log.info("request请求参数：{}", httpObj));

        // 设置hutool HttpUtil的response参数打印
//        GlobalInterceptor.INSTANCE.addResponseInterceptor(httpObj -> log.info("response响应参数：{}", httpObj));

        // 设置hutool HttpUtil的连接超时时间、读取响应超时时间
        HttpGlobalConfig.setTimeout(30 * 1000);
    }
}
