[
https://issues.apache.org/jira/browse/CAMEL-15410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kris Boutilier updated CAMEL-15410:
-----------------------------------
Description:
When passing query parameters to a REST producer the encoding behavior is
inconsistent. Consider the following:
{code:java}
.to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select=personId,personName&disconnect=true")
{code}
The resulting request payload, as observed with Wireshark, is:
{code:java}
GET
/bw-web-api/v1/objects/employees?companyId=RD&disconnect=true&select=personId%252CpersonName
HTTP/1.1\r\n{code}
Note that the comma has been double-encoded resulting in transmission of %252C
instead of the expected %2C.
If instead the problem string is passed as a parameter via a header, the comma
is correctly encoded:
{code:java}
.setHeader("select", simple("personId,personName"))
.to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select={select}&disconnect=true")
{code}
was:
When passing query parameters to a REST producer the encoding behavior is
inconsistent. Consider the following:
{code:java}
.to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select=personId,personName&disconnect=true")
{code}
The resulting request payload, as observed with Wireshark, is:
{code:java}
GET
/bw-web-api/v1/objects/employees?companyId=RD&disconnect=true&select=personId%252CpersonName
HTTP/1.1\r\n{code}
Note that the comma has been double-encoded resulting in transmission of %252C
instead of the expected %2C.
If instead the problem string is passed as a parameter via a header, the comma
is correctly escaped:
{code:java}
.setHeader("select", simple("personId,personName"))
.to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select={select}&disconnect=true")
{code}
> REST endpoint has inconsistent URL Encoding
> --------------------------------------------
>
> Key: CAMEL-15410
> URL: https://issues.apache.org/jira/browse/CAMEL-15410
> Project: Camel
> Issue Type: Bug
> Components: rest
> Affects Versions: 3.4.2
> Reporter: Kris Boutilier
> Priority: Minor
>
> When passing query parameters to a REST producer the encoding behavior is
> inconsistent. Consider the following:
> {code:java}
> .to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select=personId,personName&disconnect=true")
> {code}
> The resulting request payload, as observed with Wireshark, is:
> {code:java}
> GET
> /bw-web-api/v1/objects/employees?companyId=RD&disconnect=true&select=personId%252CpersonName
> HTTP/1.1\r\n{code}
> Note that the comma has been double-encoded resulting in transmission of
> %252C instead of the expected %2C.
> If instead the problem string is passed as a parameter via a header, the
> comma is correctly encoded:
> {code:java}
> .setHeader("select", simple("personId,personName"))
> .to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select={select}&disconnect=true")
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)