index.md 2.2 KB

net / com.drake.net.utils / okhttp3.OkHttpClient.Builder

Extensions for okhttp3.OkHttpClient.Builder

Name Summary
onDialog 全局加载对话框设置 设置在使用scopeDialog自动弹出的加载对话框fun Builder.onDialog(block:DialogCoroutineScope.(FragmentActivity) ->Dialog): <ERROR CLASS>
onError 全局网络请求错误捕获fun Builder.onError(block:Throwable.() ->Unit): <ERROR CLASS>
onStateError 全局缺省页错误捕获fun Builder.onStateError(block:Throwable.(view:View) ->Unit): <ERROR CLASS>
setConverter 转换器fun Builder.setConverter(converter:NetConverter): <ERROR CLASS>
setHost 设置全局默认的Host, 在使用com.drake.net.request.BaseRequest.setPath的时候会成为默认的Hostfun Builder.setHost(host:String): <ERROR CLASS>
setLog 开启日志fun Builder.setLog(enabled:Boolean): <ERROR CLASS>
setRequestInterceptor 添加轻量级的请求拦截器, 可以在每次请求之前修改参数或者客户端配置 该拦截器不同于OkHttp的Interceptor无需处理请求动作fun Builder.setRequestInterceptor(interceptor:RequestInterceptor): <ERROR CLASS>