https://kotlinlang.org logo
Title
b

ByteZ

02/09/2022, 3:23 PM
Does ktor automatically convert request header keys to some weird camel case? My GitHub webhook allegedly sends the header
X-GitHub-Event
but the server receives
X-Github-Event
with a lower case h. I've contacted GitHub support and they said it's caused by the receiving server. If it Is caused by ktor, is there a way to keep the original names?
s

spand

02/09/2022, 3:59 PM
Arent headers supposed to be case insensitive ?
b

ByteZ

02/09/2022, 4:14 PM
Yes which is why this causes issues for me
a

Aleksei Tirman [JB]

02/11/2022, 8:33 AM
If I send
X-GitHub-Event: 123
to a Ktor server with the following code:
routing {
    get("/") {
        call.request.headers.forEach { s, strings -> println(s) }
    }
}
then the following is printed:
Host
User-Agent
Accept
Accept-Charset
X-GitHub-Event
content-length
b

ByteZ

02/11/2022, 12:09 PM
Hm weird. Maybe it's caused by my reverse proxy. I'll look into that