Ktor Client HTTP Cache
See original GitHub issueKtor Version
Ktor 1.1.3
Ktor Engine Used(client or server and name)
Ktor Client iOS engine
JVM Version, Operating System and Relevant Context
Feedback
I’m building a multi-platform (Android and iOS) kotlin project, using ktor client, and i want to have HTTP cache implemented. For android i’m using the OKHTTP client, and configuring the Cache using the HttpConfig.
In iOS i was expecting to have the default caching policy, but in the code, https://github.com/ktorio/ktor/blob/0b3548afa30ff11d13c7496c0047465a6825682f/ktor-client/ktor-client-ios/darwin/src/io/ktor/client/engine/ios/IosClientEngine.kt#L86 it is being set to NSURLRequestReloadIgnoringCacheData
Since the config parameter in the constructor is currently not used for anything, is there other way i can change http cache policy for iOS?
Why is the cache being disabled on the iOS Client? Can it lead to problems?
Thanks in advance
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top GitHub Comments
With the HttpCache feature installed it works as expected on iOS:
The sample project is attached ios_cache.zip
If you have a case where caching doesn’t work as expected please describe it in the relevant YouTrack issue.
Hi @jrocharodrigues, thanks for the report.
We try to unify the client behavior with each engine. So we set
HttpCache
disabled by default. Probably we should expose request configuration in engine config.