Key/value pairs problem in HTTP request body

I’m migrating a ColdFusion REST API (currently running on CF11) over to Lucee

By default the API accepts POST requests where arguments are sent raw in the body of the HTTP request as a single string of key/values separated by an amphersand, ie.

field1=apple&field2=pear

This works fine in ACF but when moving to Lucee, the second argument is not set.

Dumping out the form scope I get only 1 form variable called field1 which contains the value apple&field2=pear

If I modify the request to a single field, field1=apple only I get field1 which contains apple

So the issue appears to be the ampersand - I have tried different escaping such as %26 or & but neither works.

This behaviour is consistent across 2 different servers, so I’m thinking that I’m missing a setting in Lucee admin somewhere?

Thanks for any thoughts on this?

Cheers

Dom

OS: Ubuntu on AWS
Java Version: 11.0.6 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.31
Lucee Version: 5.3.4.80

can you post what the request looks like via browser vs v the api?

Hi @Zackster, thanks for your reply.

I am testing directly via Postman at the moment rather than using a browser - is that helpful?

For completeness, it turned out that Postman was the culprit. The server to server calls I tried as an alternative resulted in the correct number of FORM key value pairs, while Postman presented them as a single string.

Couldn’t be bothered to figure it out further and put a solution in place in onRequestStart() to catch and reformat the FORM scope as appropriate

1 Like