fix: replace deprecated MediaType.parse() with toMediaType() extension

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 22:25:33 +08:00
parent 21a06e8664
commit 50de6f3dee

View File

@@ -8,6 +8,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import java.io.IOException
class AuthInterceptor(
@@ -89,7 +90,7 @@ class AuthInterceptor(
val client = OkHttpClient()
val body = okhttp3.RequestBody.create(
okhttp3.MediaType.parse("application/json")!!,
"application/json".toMediaType(),
"""{"refresh_token":"$refreshToken"}"""
)
val refreshUrl = (cachedServerUrl ?: com.tiangong.aiagent.BuildConfig.BASE_URL).trimEnd('/') + "/api/v1/auth/refresh"