title: Apache camel how to submit body in "body" format
body: <p>Using Apache camel, I have Rest component. It looks like:</p>
  
  <pre><code>    &lt;post uri="/body" method="POST"&gt;
          &lt;description&gt;Here is post method&lt;/description&gt;
          &lt;param name="save" type="body" dataType="string"/&gt;
          &lt;route&gt;
              &lt;process ref="postRedirectProcessor" /&gt;
              &lt;to uri="direct:commonRoute" /&gt;
          &lt;/route&gt;
      &lt;/post&gt;
  </code></pre>
  
  <p>And this endpoint processes fine requests like this:</p>
  
  <pre><code>curl -i --data "b=hereisbody" http://localhost:8080/body (works fine, but I don't need it)
  </code></pre>
  
  <p>(I can see it goes into <strong>postRedirectProcessor</strong> and that is fine). But this is not what I want. I want it to process requests like this:</p>
  
  <pre><code>curl -i --data "hereisbody" http://localhost:8080/body (doesn't work, causes 405)
  </code></pre>
  
  <p>I mean, format of "data" is <strong>not</strong> like <strong>k=v&amp;k2=v2</strong>, but it is just string, like in example (such as <strong>--data "something"</strong>). </p>
  
  <p>It causes an exception, it doesn't go into postRedirectProcessor.</p>
  
  <pre><code>2020-04-10 18:43:09,716 ERROR [http-nio-8080-exec-6] - ,,, - Servlet.service() for servlet [CamelServlet] in context with path [] threw exception
  java.lang.IllegalArgumentException: Invalid parameter, expected to be a pair but was hereisbody
      at org.apache.camel.http.common.DefaultHttpBinding.readFormUrlEncodedBody(DefaultHttpBinding.java:272) ~[camel-http-common-2.24.3.jar:2.24.3]
      at org.apache.camel.http.common.DefaultHttpBinding.readRequest(DefaultHttpBinding.java:116) ~[camel-http-common-2.24.3.jar:2.24.3]
      at org.apache.camel.http.common.HttpMessage.&lt;init&gt;(HttpMessage.java:56) ~[camel-http-common-2.24.3.jar:2.24.3]
      at org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:187) ~[camel-http-common-2.24.3.jar:2.24.3]
      at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79) ~[camel-http-common-2.24.3.jar:2.24.3]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.31.jar:9.0.31]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.31.jar:9.0.31]
  </code></pre>
  
  <p>I thought, <strong>param type="body"</strong> as in xml posted, does the trick, but no luck.</p>