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

Rest DSL Producer HTTP ignores http verb from uri

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.19.0
    • 2.19.1, 2.20.0
    • camel-http4, rest
    • None
    • 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

            davsclaus Claus Ibsen
            owain Owain McGuire
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: