https://kotlinlang.org logo
Title
m

Mikael Ståldal

05/26/2023, 1:29 PM
Is there a way to get a
Map
(or similar data structure) of all query parameteres in a request? I need to deal with dynamic query parameters.
d

dave

05/26/2023, 1:35 PM
Request(Method._GET_, "").uri._queries_()
m

Mikael Ståldal

05/26/2023, 1:46 PM
request.uri._queries_()._toParametersMap_()
seems to do what I need. But why is the type
Map<String, List<String?>>
and not
Map<String, List<String>>
?
d

dave

05/26/2023, 1:47 PM
because queries don't have to have a value
m

Mikael Ståldal

05/26/2023, 1:48 PM
So like
/foo?q1=&q2=bar
, then
q1
will be
null
? Or empty string?
d

dave

05/26/2023, 1:49 PM
try it out! 🙂
m

Mikael Ståldal

05/26/2023, 1:53 PM
Seems to be empty string. So when will it be null?
d

dave

05/26/2023, 1:54 PM
"<http://asd/asd?a&b=c&c=>"
m

Mikael Ståldal

05/26/2023, 1:55 PM
Ah, right.