MBegemot
02/28/2023, 5:46 PMAleksei Tirman [JB]
03/01/2023, 4:56 PMMBegemot
03/02/2023, 11:41 AMinline fun<reified T> z(path:String, abody: T?=null):HttpRequestBuilder {
val sz=HttpRequestBuilder()
sz.url("<http://knews1939.ey.r.appspot.com/$path>")
//sz.url("<http://0.0.0.0:8080/$path>")
//sz.timeout { 1000 }
//sz.header("Connection", "close")
//sz.timeout { requestTimeoutMillis=50000
// connectTimeoutMillis=5000
//}
//sz.header("Accept-Encoding","gzip")
sz.contentType(ContentType.Application.Json)
if (abody != null) sz.setBody(abody)
return sz
}
@OptIn(ExperimentalTime::class)
suspend inline fun <reified T> serverPost33(sNameService: String, params: Any? = null): KResult<T> {
val tl = measureTimedValue {
//val u=z(sNameService, params)
//logger.warn { "PASSSEDDD" }
//runCatching { <http://client.post|client.post>(u).body<T>() }
runCatching { <http://client.post|client.post>(z(sNameService, params)).body<T>() }
}
val kr=KResult(tl.value, srv_time, tl.duration.inWholeMilliseconds, srv_error,"serverPost33('$sNameService','$params')")
//if(kr.res.isFailure) logger.error { kr.logInfo() }
//else logger.debug { kr.logInfo() }
client.close()
return kr
}
}