Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lz233 committed Oct 30, 2024
2 parents d8a39c2 + 936010c commit 7d5d23c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/cn/ac/lz233/tarnhelm/util/ktx/OkHttp.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package cn.ac.lz233.tarnhelm.util.ktx

import android.webkit.WebSettings
import cn.ac.lz233.tarnhelm.App
import cn.ac.lz233.tarnhelm.logic.Network
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
Expand All @@ -15,7 +13,9 @@ fun HttpUrl.followRedirect(userAgent: String?): HttpUrl {
.newCall(
Request.Builder()
.url(this)
.addHeader("User-Agent", if (userAgent.isNullOrEmpty()) WebSettings.getDefaultUserAgent(App.context) else userAgent)
.let {
if (userAgent.isNullOrEmpty()) it else it.addHeader("User-Agent", userAgent)
}
.build()
)
.execute()
Expand Down

0 comments on commit 7d5d23c

Please sign in to comment.