Improve Http Client Configuration (#786)

* Improve Http Client Configuration

* Lint
This commit is contained in:
Mitchell Syer
2023-12-08 19:16:38 -05:00
committed by GitHub
parent a2d3fa6e1d
commit 9b27d7ee23
5 changed files with 71 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
import mu.KotlinLogging
import okhttp3.Request
import okhttp3.CacheControl
import okio.buffer
import okio.sink
import okio.source
@@ -272,8 +272,10 @@ object Extension {
url: String,
savePath: String,
) {
val request = Request.Builder().url(url).build()
val response = network.client.newCall(request).await()
val response =
network.client.newCall(
GET(url, cache = CacheControl.FORCE_NETWORK),
).await()
val downloadedFile = File(savePath)
downloadedFile.sink().buffer().use { sink ->
@@ -350,7 +352,7 @@ object Extension {
return getImageResponse(cacheSaveDir, apkName) {
network.client.newCall(
GET(iconUrl),
GET(iconUrl, cache = CacheControl.FORCE_NETWORK),
).await()
}
}