Support array query params?
yujiri8 opened this issue · comments
Many other frameworks, such as Django and FastAPI, support retrieving all values of a query param instead of assuming there's only one. Example (Kemal master):
require "kemal"
get "/" do |env|
puts env.params.query["test"]
end
Kemal.run
Hit /?test=a?test=b
.
See only "a".
Django and FastAPI provide ways to access all values assigned to the parameter as a list/array.
You need to use #fetch_all. E.g. puts env.params.query.fetch_all "test"
. Also be sure to fix your query params. The &
separator should be used, not another ?
.
Oh thanks, I didn't realize it was URI::Params in use.