https://kotlinlang.org logo
#ktor
Title
# ktor
y

ynsok

05/25/2022, 6:13 AM
Every time I’m doing a request I’m receiving a RESPONSE: 200 OK even if I have cache enabled. So the question is how can I be sure that the current response is from the cache?
Copy code
HttpClient {
    install(Logging) {
        level = <http://LogLevel.INFO|LogLevel.INFO>
    }
    install(HttpCache)
    install(JsonFeature) {
        serializer = KotlinxSerializer(json = get())
    }
}
Copy code
client.get {
    url(url = BASE_URL)
    header(HttpHeaders.CacheControl, "only-if-cached")
}
a

Aleksei Tirman [JB]

05/25/2022, 10:09 AM
You can see it in the debugger. What problem are you trying to solve?
y

ynsok

05/25/2022, 10:50 AM
Currently on Android I’m receiving RESPONSE: 504 Unsatisfiable Request (only-if-cached)