Android版Ktor v2.0.0.
默认的ktor头"Accept"只是覆盖了我的"Accept"头.
这是我初始化HttpClient的方式:
HttpClient(Android) {
defaultRequest {
header("Key", BuildConfigCore.API_KEY)
header("Accept", "application/vnd.***.mobile-v8+json")
host = hostAddress
url.protocol = URLProtocol.HTTPS
}
install(Logging) {
if (BuildConfig.DEBUG) {
logger = Logger.DEFAULT
level = LogLevel.ALL
}
}
install(ContentNegotiation) {
gson()
}
expectSuccess = false
}
But when i check with Charles interceptor, my headers looks like:
我有这个
应用程序/json
这会覆盖我的application/vnd...
值.
有没有办法替换默认的"Accept"标题?