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

Camel-http is creating invalid Content-Encoding header based on charset from Content-Type header

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0.2, 4.1.0
    • 4.0.3, 4.2.0
    • camel-http
    • None
    • Unknown

    Description

      In case Content-Type header has ";charset=UTF-8" suffix, camel-http component creates Content-Encoding: UTF-8 header which is invalid by RFC specification.

      If you try to send request with Content-Encoding: UTF-8 to SAP systems for example, they will reject it due to invalid header. 

      YAML DSL to reproduce the issue:

       

      - route:
          nodePrefixId: route-7e2
          id: route-dafc
          from:
            uri: scheduler
            id: from-64dc
            parameters:
              name: scheduler
            steps:
              - setHeader:
                  name: Content-Type
                  expression:
                    simple:
                      expression: application/json;charset=UTF-8
                      id: simple-dc79
                  id: setHeader-2f26
              - setBody:
                  expression:
                    simple:
                      expression: |-
                        {
                          "some": "value"
                        }
                      id: simple-bfca
                  id: setBody-243c
              - to:
                  uri: http
                  id: to-2cfa
                  parameters:
                    httpUri: >-
                      01het4h4zq3gvtecszbv5rpx3y00-4f92b8ba4ea1459ece69.requestinspector.com
                    httpMethod: POST
       

      Additional notes:

      • If you remove ";charset=UTF-8" part from the Content-Type header, and call one more http request after the first one, it gets appended automatically for some reason, even if you remove Content-Type header and set it again manually (possible another bug) between two calls
      • Same behavior is for the https traffic

       

       

      Attachments

        1. Selection_894.png
          49 kB
          Damir Palinic
        2. Screenshot 2023-11-14 at 09.12.12.png
          189 kB
          Claus Ibsen

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              dpalinic Damir Palinic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: