package cn.sagacloud.server.algorithm.services.http

import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import java.util.concurrent.TimeUnit

/**
 *
 *
 * @author jxing
 */
object OkHttpService {
    val client = OkHttpClient().newBuilder().connectTimeout(30, TimeUnit.SECONDS).build()

    // TODO
    fun post(url : String, body : String) : String{
        val mediaType = "application/json".toMediaTypeOrNull()
        val requestBody: RequestBody = RequestBody.create(mediaType, body)
        val request = Request.Builder().url(url).post(requestBody).build()
        return ""
    }


}