question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Context.formParam() does not decode the keys

See original GitHub issue

Actual 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:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tipsycommented, Jun 8, 2020

I would argue that it’s fine in this case, this is an actual bug that’s being fixed.

1reaction
grzegorzborcommented, Jun 8, 2020

Ok i will take a look then and provide the PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

RESTlet appears to be doubly decoding my form parameters
I have a RESTlet application embedded in a Tomcat server and clients are complaining that % symbols in @FormParm parameters are doubly decoded...
Read more >
Binding Request Data | Echo - High performance, minimalist ...
This parses form data from both the request URL and body if content type is not MIMEMultipartForm . See documentation for non-MIMEMultipartFormand ...
Read more >
RESTEasy JAX-RS - JBoss.org
If there is an Application class but it doesn't have an @ApplicationPath annotation, then a web.xml file with at least a <servlet-mapping> element...
Read more >
Chapter 47. Passing Information into Resource Classes and ...
Example 47.5, “Disabling URI decoding” shows a resource whose getMonster() method does not use URI decoding. The addMonster() method only disables URI ...
Read more >
FormParam (Java(TM) EE 7 Specification APIs)
The name is specified in decoded form, any percent encoded literals within the value will not be decoded and will instead be treated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found