davsclaus opened a new pull request, #26751: URL: https://github.com/apache/camel/pull/26751
Fixes https://issues.apache.org/jira/browse/CAMEL-24910 (part of CAMEL-24886) A REST endpoint with a path parameter, `/stock/{sku}`, sets the header `sku` from the path. `VertxPlatformHttpSupport.populateCamelHeaders` added those with `appendEntry`, which appends to a header of that name instead of replacing it, so a request that also carried a `sku` HTTP header made `${header.sku}` a `List`: ``` $ curl -o /dev/null -w '%{http_code}' localhost:8080/stock/CAMEL-MUG 200 $ curl -o /dev/null -w '%{http_code}' -H 'sku: CAMEL-MUG' localhost:8080/stock/CAMEL-MUG 404 $ curl -H 'sku: X' localhost:8080/stock/CAMEL-MUG {"error": "unknown sku [X, CAMEL-MUG]"} ``` A correct value fails, and the error names a list that nothing in the route explains. A path parameter is single-valued and part of the route's contract, so the value from the path is used now. Query parameters may legitimately repeat (`?a=1&a=2`) and are still appended. Test: `VertxPlatformHttpEngineTest.testPathParameterWinsOverAHeaderOfTheSameName` (plain call, the same call with the header, and a repeated query parameter); it fails without the change. Suites run, since HTTP and REST are used in many places: camel-platform-http-vertx 142, camel-platform-http 44, camel-rest-openapi 143, camel-http 9, camel-servlet 102, camel-undertow 191, camel-yaml-dsl 447, all green. Found in the camel-jbang-mcp stepwise benchmark: the local model set a line's sku as a header rather than an exchange property, its own HTTP call then carried `sku`, and every call to its own service answered 404 with the list in the message. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj -- 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]
