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 okhttp3.Call

/** 可能返回空*/
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