Ktor Client is ignoring all header values but firs...
# ktor
r
Ktor Client is ignoring all header values but first in Vary Keys creation. Is this desired behaviour? In our project it breaks cache possibilities. It was tested on Ktor 2.3.0. Current code looks like this:
Copy code
internal fun HttpResponse.varyKeys(): Map<String, String> {
    val validationKeys = vary() ?: return emptyMap()

    val result = mutableMapOf<String, String>()
    val requestHeaders = call.request.headers

    for (key in validationKeys) {
        result[key] = requestHeaders[key] ?: ""
    }

    return result
}
I think that we should not take first value of requestHeaders, but all of them and join into single string:
Copy code
result[key] = requestHeaders.getAll(key).joinToString(";")
to match "mergedHeadersLookup" method which is used when Ktor is trying to retrieve value from cache
a
Can you please file an issue with the code snippet attached?