mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
Http Client is now lazy init.
This commit is contained in:
parent
01e64d3030
commit
639df4dcb9
@ -7,9 +7,11 @@ import java.util.concurrent.TimeUnit
|
|||||||
/**
|
/**
|
||||||
* A small set of utilities for making HttpCalls, aimed at demos.
|
* A small set of utilities for making HttpCalls, aimed at demos.
|
||||||
*/
|
*/
|
||||||
private val client = OkHttpClient.Builder()
|
private val client by lazy {
|
||||||
|
OkHttpClient.Builder()
|
||||||
.connectTimeout(5, TimeUnit.SECONDS)
|
.connectTimeout(5, TimeUnit.SECONDS)
|
||||||
.readTimeout(60, TimeUnit.SECONDS).build();
|
.readTimeout(60, TimeUnit.SECONDS).build();
|
||||||
|
}
|
||||||
|
|
||||||
fun putJson(url: URL, data: String) : Boolean {
|
fun putJson(url: URL, data: String) : Boolean {
|
||||||
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data)
|
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data)
|
||||||
|
Loading…
Reference in New Issue
Block a user