You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Saurabh Rai (JIRA)" <ji...@apache.org> on 2017/11/02 07:32:00 UTC

[jira] [Commented] (CAMEL-10093) camel-restlet - Message body is null

    [ https://issues.apache.org/jira/browse/CAMEL-10093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16235323#comment-16235323 ] 

Saurabh Rai commented on CAMEL-10093:
-------------------------------------

When I tested by sending a proper x-www-form-urlencoded data from one of client strangely noticed that the content sent in the body is added as a header. 
I checked the code and found that DefaultRestletBinding.java ([https://github.com/apache/camel/blob/master/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java#L136]) and looks like we check if the key is only provided and no value then we add it to the body else we check for filters and then add them to the headers. Is this correctly implemented? Should not it be available in body than in header?
When the form data is not properly formatted we should throw an exception rather than adding to the body and else if it is properly formatted we should add it to the body.

*Please look at the request:*

{color:#205081}POST /test HTTP/1.1
Host: localhost:9090
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: dff70b35-e799-b3d2-38f9-13d7ae8f9c1f

param1=value1&param2=value2{color}

*The Headers received in logs are:*
{Accept=*/*, Accept-encoding=gzip, deflate, br, Accept-language=en-US,en;q=0.8, breadcrumbId=ID-sarai-pnq-csb-36398-1509006352914-0-5, Cache-control=no-cache, CamelHttpMethod=POST, CamelHttpUri=http://localhost:9090/test, CamelRestletRequest=POST http://localhost:9090/test HTTP/1.1, CamelRestletResponse=HTTP/1.1 - OK (200) - The request has succeeded, Connection=keep-alive, Content-length=27, Content-type=application/x-www-form-urlencoded, Host=localhost:9090, org.restlet.startTime=1509007593061, Origin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop,{color:#d04437} param1=value1, param2=value2{color}, Postman-token=444af24e-f6a3-939f-8c65-81c094fa0e37, User-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36}


> camel-restlet - Message body is null
> ------------------------------------
>
>                 Key: CAMEL-10093
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10093
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-restlet
>    Affects Versions: 2.17.2, 2.18.0
>            Reporter: Claus Ibsen
>            Priority: Minor
>         Attachments: 2171.png, 2172.png
>
>
> Works with 2.17.1, but upgrading to 2.17.2 causes the message body to be empty. And in 2.17.2 then message body is mistakenly stored in a message header instead.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)