davsclaus opened a new pull request, #30873: URL: https://github.com/apache/camel/pull/30873
[CAMEL-27234](https://issues.apache.org/jira/browse/CAMEL-27234) ## Problem The rest producer factory of camel-http (`HttpComponent.createProducer`) looks up the http endpoint by its url alone (`http://host/path?httpMethod=GET`), and gives the options of the producer only as `parameters` for creating it. The options given leniently on a `rest-openapi` endpoint (such as the camel-http login options) therefore only applied to the first producer created for that url; every other producer reused that endpoint. A second `rest-openapi` endpoint of the same operation sent the login of the first one, or no `Authorization` header at all if the first one had no login options. That matches the ticket's reproduce table, where the endpoints without a 401 challenge all went out without credentials. On current `main`, a single `rest-openapi` endpoint per operation with preemptive basic, bearer or OAuth2 options already works (I checked each one alone). The failure needs several endpoints of the same operation, as in the ticket's reproduce and in a Kamelet used more than once. ## Change - `HttpComponent.createProducer` now puts the producer options that have a plain value (string, number, boolean, enum) into the endpoint url, as on a plain `http:` endpoint. Producers with different options get their own http endpoint. Options with other values (bean instances) are still passed as parameters, as before. The url of the HTTP request does not change: the same options reached the endpoint before, only through the map. - rest-openapi component page: documents that the options for the delegate component, such as the camel-http login options, can be given on the endpoint. - Upgrade guide 4.24: an entry for the change (http endpoints of rest producers now show their options; secrets are masked). ## Tests - `RestOpenApiHttpLoginTest` (camel-rest-openapi): four rest-openapi endpoints of the same operation against WireMock (dynamic port): no login, preemptive basic, bearer, OAuth2 (token endpoint call plus `Bearer <token>`). **Fails on main**: 3 of 4 fail (the first, anonymous, endpoint wins, so none of the others sends an `Authorization` header). Passes with the fix. - `HttpRestProducerParametersTest` (camel-http): three producers from `HttpComponent.createProducer` for the same url (none, basic, bearer) against a JDK `HttpServer` on port 0. **Fails on main** (`expected "Basic ..." but was null`). Passes with the fix. - camel-http: 322 tests, 0 failures. One flake on the first run, `HttpOAuth2TokenCachingTest.toDTokenIsNotCachedWhenCacheTokensIsFalse` (a `SocketException` where the test expects only `HttpHostConnectException` or `NoHttpResponseException`; it does not go through `createProducer`), passed on rerun. - camel-rest-openapi: 248 tests, 0 failures (built against the patched camel-http). ## Upgrade notes See the new entry "camel-http - the producer of a rest-openapi endpoint uses its own options" in the 4.24 upgrade guide. _Claude Code on behalf of davsclaus_ 🤖 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]
