perk
10 years agoAdept
HTTP client URL encoding
Hi,
I am wondering if anyhow knows how to get the HTTP client to work with special characters.
I have a URL string that contains "+" and ":". If I use the FreeMarker ?url method for the string, I get something like:
https%3A%2F%2Fabc.com%2Fapi%2Fv2%2Fsearch.json%3Fpage%3D2%26query%3Dtabc%253Acba%2Babc%253Acba
which fails in Lithium with this error message:
Method public final lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel lithium.coreapi.webui.template.models.HttpClientTemplateModel.request(java.lang.String) throws freemarker.template.TemplateModelException threw an exception when invoked on lithium.coreapi.webui.template.models.HttpClientTemplateModel object "lithium.coreapi.webui.template.models.HttpClientTemplateModel@e453be1" with arguments of types [java.lang.String,]. See cause exception. The failing instruction (FTL stack trace):
If I manually replaced the "+" with " " and leave ":" as decoded, the call fails intermittently with the same error.