Coverage Summary for Class: IsNetworkAvailableKt (com.javiersc.network.either.utils)
Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
IsNetworkAvailableKt |
100%
(2/2)
|
|
100%
(2/2)
|
100%
(16/16)
|
IsNetworkAvailableKt$isNetworkAvailable$1 |
100%
(1/1)
|
|
100%
(1/1)
|
100%
(45/45)
|
Total |
100%
(3/3)
|
|
100%
(3/3)
|
100%
(61/61)
|
package com.javiersc.network.either.utils
import com.javiersc.network.either.internal.Constants
import io.ktor.client.HttpClient
import io.ktor.client.request.head
import kotlinx.coroutines.runBlocking
public val isNetworkAvailable: Boolean
get() = runBlocking { runCatching { httpClient.head(urlString = Constants.DnsUrl) }.isSuccess }
private val httpClient = HttpClient()