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

reactormonk

04/02/2024, 12:33 AM
What's the best way to fully dump a ktor request? I'm getting a 406 from the server, but I can't figure out why, neither can reproduce it with httpie.
Code:
Copy code
val creation = client.request(url.build()) {
        basicAuth("admin", rabbitmqPassword)
        method = m
        contentType(ContentType.Application.Json)
        setBody(body)
    }
Making the same request with httpie works just fine.
Copy code
val client = HttpClient(CIO) {
    install(ContentNegotiation) {
        json()
    }
}
This looks a bit fishy:
Copy code
TRACE i.k.c.p.c.ContentNegotiation - Adding Accept=application header for
Ah nah, just a bit unfortunate logging
🤨
Copy code
TRACE i.k.c.p.compression.ContentEncoding - Adding Accept-Encoding=io.ktor.client.request.HttpRequestBuilder@36254a64 for
Ah 🤦 406 vs. 400
a

Aleksei Tirman [JB]

04/02/2024, 6:36 AM
I would make requests with either client while observing HTTP traffic in Wireshark to determine the difference.
r

reactormonk

04/02/2024, 9:35 AM
Burp with https mitm proxy would probably work even better