-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request.params do not allow duplicate parameters #247
Comments
What are people doing for this now? |
would be nice to fix this |
Hey @dom96, I'd be interested to implement this since I want to use it myself (to use Before creating a PR I just wanted to get some input from you regarding the implementation. tables.addI'd avoid this since it has been deprecated since nim 1.4. joining values on a characterSince -> This would fail as soon as the user has a percent-endoding for the "join character" in their query value (e.g. changing the return typeThis would completely break all existing programs relying on custom
|
let contentType = req.headers.getOrDefault("Content-Type") | |
if contentType.startswith("application/x-www-form-urlencoded"): | |
try: | |
parseUrlQuery(req.body, result) | |
except: | |
logging.warn("Could not parse URL query.") |
parseUrlQuery
is deprecated and points towards cgi/decodeData which you're already using in params.
The main difference seems to be that key
is also url decoded in parseUrlQuery
.
@torbencarstens, |
Would you mind elaborating a bit on this, I guess you agree with implementing the This would implicitely avoid parsing twice unless the user calls both I wouldn't use the Users calling both This solution would basically look like this (I chose
(this assumes that the As a side note regarding the |
My suggestion was for a way to do it without changing jester-code, but just hooking in on available fields = the For your suggested solutions, I'm in favor of the |
…Seq` In contrast to `params` this returns a `Table[string, seq[string]]`. Closes dom96#247
jester/jester/request.nim
Line 95 in d8a03aa
Sometimes, in query strings, you need to pass lists. This is generally done by duplicating the same key over like:
name=a&name=b
. juster folds these into a single parameter in the above code. Instead of using[]=
to add new parameters,add
allows key duplicates.The text was updated successfully, but these errors were encountered: