davsclaus opened a new pull request, #3241:
URL: https://github.com/apache/camel-kamelets/pull/3241

   Fixes #3240.
   
   Each sink and action that calls a Camel component now removes the headers of 
that component as its first step, so a header that comes along with the message 
cannot change what the Kamelet was configured to do.
   
   ## Changes
   
   - **88 Kamelets**: a `removeHeaders` step with the prefix of the component 
(such as `CamelAwsS3*`, `CamelJms*`, `CamelKafka*`, `CamelSmpp*`) is the first 
step of the template, and a sentence in "Good to know" says so.
     - The steps of the template that set those headers on purpose, from 
options or from the `file`, `key` and similar headers, run after it and keep 
working.
     - Headers a Kamelet documents as input are kept with `excludePattern`, for 
example `CamelSmppDestAddr`, `CamelAwsS3ContentType` and 
`CamelAwsS3StorageClass`, `CamelAwsDdbOperation`, 
`CamelPulsarProducerMessageKey`, `CamelCouchbaseId`, `CamelFileName` for the 
FTP/SFTP/SCP sinks, and `CamelKafkaKey` and `CamelKafkaOverrideTopic` for the 
Kafka sinks (set by the key and router actions).
   - **HTTP Kamelets**: `rest-openapi-sink`, `ogcapi-features-action` and 
`azure-functions-sink` remove the `CamelHttp*` and `CamelRestHttp*` headers, as 
`http-sink` does.
   - **azure-functions-sink**: the key is sent in the `x-functions-key` header 
instead of the `code` query parameter, so it is not part of the request address 
or its error messages, and the header is removed after the call.
   - **Not changed**: `exec-sink` and `ssh-sink` (they take the command from 
headers by design), the actions whose job is to set headers (Kafka router and 
key actions, `insert-header-action`, ...), and the Kamelets that already 
removed their headers before the call (SQL sinks, `cassandra-sink`, 
`http-sink`, `mail-sink`, `aws-ec2-sink`, `aws-bedrock-agent-sink`, 
`docling-convert-action`).
   
   ## Tests
   
   - `KameletsRemoveHeadersTest`: for every changed Kamelet (table in 
`remove-headers/kamelets.csv`), the first step is the expected `removeHeaders`, 
and `Message.removeHeaders` with that pattern removes a header of the component 
and keeps the documented inputs.
   - `HttpKameletsTargetTest`: runs `rest-openapi-sink`, 
`ogcapi-features-action` and `azure-functions-sink` against a local server, 
with `CamelHttpUri`, `CamelHttpPath`, `CamelHttpQuery`, `CamelRestHttpUri` and 
similar headers on the message, and checks that the request goes to the 
configured server, path and query. These tests fail on the templates of `main`.
   - `./mvnw clean install` passes.
   
   ## Upgrade
   
   A flow that set such a header on purpose before a sink now has to use the 
option of the Kamelet, or call the Camel component directly. To be added to the 
upgrade notes (#3190).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to