troyzhxu/okhttps

新建多个HTTP实例问题

godlikewangjun opened this issue · 1 comments

本身需要几个实例来处理不同接口的返回,但是在插入日志解析的时候,怎么都只执行了最后一个的配置。
HTTP.builder()
.baseUrl(httpUrl)
.addMsgConvertor(Fastjson2MsgConvertor())
.charset(Charset.forName("UTF-8"))
.config {builder->
// 连接超时时间(默认10秒)
builder.connectTimeout(10, TimeUnit.SECONDS)
// 写入超时时间(默认10秒)
builder.writeTimeout(10, TimeUnit.SECONDS)
// 读取超时时间(默认10秒)
builder.readTimeout(10, TimeUnit.SECONDS)

// val logging = HttpLoggingInterceptor()
// logging.setLevel(HttpLoggingInterceptor.Level.BODY)
// HttpLoggingInterceptor.logging = {
// println(it)
// }
// // 添加日志拦截器
// builder.addInterceptor(logging)
}
.build()
都是这样实例化的

描述不清晰,无法帮助到你。