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

Robert Jaros

03/31/2020, 8:52 PM
Why is Ktor client sending
Accept: application/xml;application/json
header when I call:
Copy code
<http://httpClient.post|httpClient.post>(serviceUrl) {
                contentType(ContentType.Application.Json)
                accept(ContentType.Application.Xml)
                body = MyClass(...)
            }
Does such header even conform to HTTP standard?
This is how httpClient is defined:
Copy code
val httpClient = HttpClient(Apache) {
        install(JsonFeature) {
            serializer = KotlinxSerializer()
        }
        engine {
            socketTimeout = 60_000
        }
    }
Content types in the
Accept
header should be separated by a comma, am I right?
👍 1
d

Dennis

04/01/2020, 7:51 AM
oh no, parameters are separated by semicolon
Copy code
Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c
r

Robert Jaros

04/01/2020, 2:19 PM
2 Views