All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jchanghong.http.okhttps.kt Maven / Gradle / Ivy

package com.github.jchanghong.http

import cn.hutool.json.JSONUtil
import com.github.jchanghong.log.kInfo
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import org.slf4j.LoggerFactory
import java.security.SecureRandom
import java.security.cert.X509Certificate
import javax.net.ssl.*

/** 可能返回空*/
fun Call.executeFroUtf8(): String {
    val execute = this.execute()
    val body = execute.body?.string()?:""
    return body
}
/** {"type":0,"code":"0", code=0*/
fun String?.pviaOkBody(): Boolean {
//
    if (this.isNullOrBlank()) return false
    try {
        val code = JSONUtil.parseObj(this).getStr("code")
        return "0"==code
    } catch (e: Exception) {
        return false
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy