Update dependencies (#611)

This commit is contained in:
Mitchell Syer
2023-08-04 22:48:24 -04:00
committed by GitHub
parent 3675580d87
commit 689847d864
9 changed files with 35 additions and 32 deletions
@@ -67,7 +67,7 @@ suspend fun Call.await(): Response {
}
continuation.resume(response) {
response.body?.closeQuietly()
response.body.closeQuietly()
}
}
@@ -120,7 +120,7 @@ fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListene
.addNetworkInterceptor { chain ->
val originalResponse = chain.proceed(chain.request())
originalResponse.newBuilder()
.body(ProgressResponseBody(originalResponse.body!!, listener))
.body(ProgressResponseBody(originalResponse.body, listener))
.build()
}
.build()
@@ -132,7 +132,7 @@ inline fun <reified T> Response.parseAs(): T {
// Avoiding Injekt.get<Json>() due to compiler issues
val json = Injekt.getInstance<Json>(fullType<Json>().type)
this.use {
val responseBody = it.body?.string().orEmpty()
val responseBody = it.body.string()
return json.decodeFromString(responseBody)
}
}
@@ -22,5 +22,5 @@ fun Element.attrOrText(css: String): String {
* @param html the body of the response. Use only if the body was read before calling this method.
*/
fun Response.asJsoup(html: String? = null): Document {
return Jsoup.parse(html ?: body!!.string(), request.url.toString())
return Jsoup.parse(html ?: body.string(), request.url.toString())
}
@@ -260,7 +260,7 @@ object Extension {
val downloadedFile = File(savePath)
downloadedFile.sink().buffer().use { sink ->
response.body!!.source().use { source ->
response.body.source().use { source ->
sink.writeAll(source)
sink.flush()
}
@@ -27,7 +27,7 @@ suspend fun Call.await(): Response {
}
continuation.resume(response) {
response.body?.closeQuietly()
response.body.closeQuietly()
}
}
@@ -26,16 +26,12 @@ class UnzippingInterceptor : Interceptor {
@Throws(IOException::class)
private fun unzip(response: Response): Response {
if (response.body == null) {
return response
}
// check if we have gzip response
val contentEncoding: String? = response.headers["Content-Encoding"]
// this is used to decompress gzipped responses
return if (contentEncoding != null && contentEncoding == "gzip") {
val body = response.body!!
val body = response.body
val contentLength: Long = body.contentLength()
val responseBody = GzipSource(body.source())
val strippedHeaders: Headers = response.headers.newBuilder().build()
@@ -45,7 +45,7 @@ object AppMutex {
.build()
val response = try {
client.newCall(request).execute().use { response -> response.body!!.string() }
client.newCall(request).execute().body.string()
} catch (e: IOException) {
return AppMutexState.Clear
}