Package com.drake.net.okhttp

Functions

attachToNet
Link copied to clipboard
fun Call.attachToNet()
Call附着到Net上
cancelGroup
Link copied to clipboard
fun OkHttpClient.cancelGroup(group: Any?)
取消OkHttp客户端中指定Group的请求 如果使用的是Net创建的网络请求请使用com.drake.net.Net.cancelGroup
cancelId
Link copied to clipboard
fun OkHttpClient.cancelId(id: Any?)
取消OkHttp客户端中指定Id的请求 如果使用的是Net创建的网络请求请使用com.drake.net.Net.cancelId
detachFromNet
Link copied to clipboard
fun Call.detachFromNet()
Call从Net上分离释放引用
onDialog
Link copied to clipboard
fun OkHttpClient.Builder.onDialog(block: (FragmentActivity) -> Dialog): OkHttpClient.Builder
全局加载对话框设置 设置在使用scopeDialog自动弹出的加载对话框
onError
Link copied to clipboard
fun OkHttpClient.Builder.onError(block: Throwable.() -> Unit): OkHttpClient.Builder
全局网络请求错误捕获
onStateError
Link copied to clipboard
fun OkHttpClient.Builder.onStateError(block: Throwable.(view: View) -> Unit): OkHttpClient.Builder
全局缺省页错误捕获
setConverter
Link copied to clipboard
fun OkHttpClient.Builder.setConverter(converter: NetConverter): OkHttpClient.Builder
转换器
setDialogFactory
Link copied to clipboard
fun OkHttpClient.Builder.setDialogFactory(dialogFactory: NetDialogFactory): OkHttpClient.Builder
全局请求自动弹出的对话框会覆盖onDialog
setErrorHandler
Link copied to clipboard
fun OkHttpClient.Builder.setErrorHandler(handler: NetErrorHandler): OkHttpClient.Builder
全局错误处理器会覆盖onErroronStateError
setHost
Link copied to clipboard
fun OkHttpClient.Builder.setHost(host: String): OkHttpClient.Builder
设置全局默认的Host, 在使用com.drake.net.request.BaseRequest.setPath的时候会成为默认的Host
setLog
Link copied to clipboard
fun OkHttpClient.Builder.setLog(enabled: Boolean): OkHttpClient.Builder
开启日志
setRequestInterceptor
Link copied to clipboard
fun OkHttpClient.Builder.setRequestInterceptor(interceptor: RequestInterceptor): OkHttpClient.Builder
添加轻量级的请求拦截器, 可以在每次请求之前修改参数或者客户端配置 该拦截器不同于OkHttp的Interceptor无需处理请求动作
setSSLCertificate
Link copied to clipboard
fun OkHttpClient.Builder.setSSLCertificate(trustManager: X509TrustManager?, bksFile: InputStream? = null, password: String? = null): OkHttpClient.Builder
fun OkHttpClient.Builder.setSSLCertificate(vararg certificates: InputStream, bksFile: InputStream? = null, password: String? = null): OkHttpClient.Builder
toNetOkhttp
Link copied to clipboard
fun OkHttpClient.toNetOkhttp(): OkHttpClient
fun OkHttpClient.Builder.toNetOkhttp(): OkHttpClient.Builder
Net拦截器代理OkHttp
trustSSLCertificate
Link copied to clipboard
fun OkHttpClient.Builder.trustSSLCertificate(): OkHttpClient.Builder
信任所有证书