khttp icon indicating copy to clipboard operation
khttp copied to clipboard

Issue with this .decode call

Open PedroD opened this issue 4 years ago • 0 comments

https://github.com/ascclemens/khttp/blob/39f76b41869ce9ffe6a5daa50ebfbe1ff533f36c/src/main/kotlin/khttp/requests/GenericRequest.kt#L208

This decode call reverts the previous encode operation from Parameters's toString method. Why?

Also, this is problematic because requests are being made un-encoded, i.e., params in the URL have invalid characters.

Reproduce:

fun main() {
    val res = get(
        url = "http://localhost", // Listen to the URL you receive with netcat or something
        params = mapOf(
            "param1" to "2312312321&4324324324", // Notice the "&" character
            "param2" to "1"
        )
    )

    print(res.url)
}

PedroD avatar Jan 21 '21 19:01 PedroD