Hi, what is the best way to get query parameter as...
# ktor
b
Hi, what is the best way to get query parameter as list such as
/foo?ids=123,234,345
, also some requests come like this
/foo?ids=123&ids=234&ids=345
a
Here is a function you can use to get a list of query parameter values:
Copy code
fun ApplicationRequest.getQueryList(name: String): List<String> {
    val result = mutableListOf<String>()
    (queryParameters.getAll(name) ?: emptyList()).forEach {
        result.addAll(it.split(','))
    }
    return result
}
🙏 1
b
i use something similar, i had wondered if there is better way. Thanks a lot