Greetings,

Camel is modifying my headers representing single item array and I do not now 
if it is a bug or a feature.

If I sent header with value ["value"] through simple camel proxy, the other end 
receives the value without the square brackets: "value"

I have reproduced this in karaf 4.3.2 and Camel 3.10.0

This simple camel route is accepting request with header testOutside and adding 
its own named testInside. Send it to another endpoint which prints the content 
of those two headers to the body. The testInside header is OK, the testOutside 
header is stripped of the brackets. Both headers are without brackets when 
returned to the client.

Route:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
    <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
        <route>
            <from uri="jetty:http://0.0.0.0:8000/HeaderTest"/>
            <setHeader name="testInside">
                <constant>["value"]</constant>
            </setHeader>
            <to uri="http://localhost:8000/HeaderTestLog?bridgeEndpoint=true"/>
        </route>
        <route>
            <from uri="jetty:http://0.0.0.0:8000/HeaderTestLog"/>
            <setBody>
                <simple>outside value: ${header.testOutside}\ninside value: 
${header.testInside}</simple>
            </setBody>
            <to uri="log:HeaderTestLog?showAll=true"/>
        </route>
    </camelContext>
</blueprint>

Request:

GET http://localhost:8000/HeaderTest HTTP/1.1
Accept-Encoding: gzip,deflate
testOutside: ["value"]
Host: localhost:8000

Response:

HTTP/1.1 200 OK
Accept-Encoding: gzip,deflate
Server: Jetty(9.4.40.v20210413)
testInside: "value"
testOutside: "value"
User-Agent: Apache-HttpClient/4.5.5 (Java/12.0.1)
Transfer-Encoding: chunked

outside value: "value"
inside value: ["value"]



Is there someone who understand what is going on? Can I prevent Camel to modify 
headers not meant for it? It is not like the array syntax is according to RFC, 
so I do not think Camel is producing equivalent header form.

Thank you in advance for your time and your answers
kind regards
Miroslav Borský

Reply via email to