Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15410

REST endpoint has inconsistent URL Encoding

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.2
    • Fix Version/s: 3.10.0
    • Component/s: rest
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When passing query parameters to a REST producer the encoding behavior is inconsistent. Consider the following:

      .to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select=personId,personName&disconnect=true")
      

      The resulting request payload, as observed with Wireshark, is:

      GET /bw-web-api/v1/objects/employees?companyId=RD&disconnect=true&select=personId%252CpersonName HTTP/1.1\r\n

      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:

      .setHeader("select", simple("personId,personName"))
      .to("rest:get:bw-web-api/v1/objects/employees?host=agresso&companyId=RD&select={select}&disconnect=true"

       

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              kris.boutilier@gmail.com Kris Boutilier
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: