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

Rest DSL Producer HTTP ignores http verb from uri

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.19.0
    • Fix Version/s: 2.19.1, 2.20.0
    • Component/s: camel-http4, rest
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      As per http://camel.465427.n5.nabble.com/2-19-0-Rest-Producer-DSL-http4-support-for-PUT-workaround-td5799706.html

      https://github.com/apache/camel/blob/camel-2.19.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpMethodHelper.java#L64

      The createMethod function does not take the http verb from the URI, PUT is transformed to a POST since there is a payload. Resulting in an incorrect http request being formed. The verb from the URI should take precedence.

      There is a workaround of setting Exchange.HTTP_METHOD header as per:

      .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.PUT))
      .to("rest:put:api/resource/resource.id")

      HttpHelperTest is lacking coverage of http verbs other than GET and POST

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              owain Owain McGuire
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: