Context.formParam() does not decode the keys
See original GitHub issueActual behavior (the bug)
When you submit a form using POST method, the input names are encoded by the browser. For example,
<input name="user[type]" value="admin">
will be submitted in POST body as:
user%5Btype%5D=admin
I would expect it to be decoded by javalin, so that I can get it by calling:
Context.formParam("user[type]")
But this doesn’t work. The formParams map keeps the keys in the encoded form, so i have to use it this way:
Context.formParam("user%5Btype%5D")
This is really awkward, and definitely looks like a bug. Was it done for purpose this way? Or am i missing some configuration settings?
Expected behavior Context.formParam(“user[type]”) should return the value “admin”, not null
To Reproduce Just create a form with method=POST and a input named “user[type]” or similar, and submit it, and try accessing the param value via Context.formParam
Additional context Add any other context about the bug here
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
I would argue that it’s fine in this case, this is an actual bug that’s being fixed.
Ok i will take a look then and provide the PR