Damir Palinic created CAMEL-20099:
-------------------------------------
Summary: Camel-http is creating invalid Content-Encoding header
based on charset from Content-Type header
Key: CAMEL-20099
URL: https://issues.apache.org/jira/browse/CAMEL-20099
Project: Camel
Issue Type: Bug
Components: camel-http
Affects Versions: 4.1.0
Reporter: Damir Palinic
Attachments: Selection_894.png
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:
{code:java}
- 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
{code}
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
--
This message was sent by Atlassian Jira
(v8.20.10#820010)