davsclaus opened a new pull request, #30735: URL: https://github.com/apache/camel/pull/30735
_Claude Code on behalf of davsclaus_ JIRA: https://issues.apache.org/jira/browse/CAMEL-27204 A media type with a space after the `;` of a parameter (`application/json; q=0.5`, or `application/json; charset=utf-8` from an OpenAPI spec) was sent as `application/json;+q=0.5` in the `Accept` and `Content-Type` headers. `MimeTypeHelper.sanitizeMimeType` turned every space into a `+`. That repairs a `+` that URI decoding turned into a space (`application/xslt xml`), but it also hit the spaces in parameters. ## Changes - `MimeTypeHelper.sanitizeMimeType` (camel-util): the `+` repair applies only to the `type/subtype` token and to unquoted parameter values (a space is not valid in a token). - The spaces around `;` and `=` are removed: `application/json; q=0.5` becomes `application/json;q=0.5`. - A quoted parameter value is kept as is, and a `,` or `;` inside quotes no longer splits the value. Empty media types and parameters are dropped. - The callers are `RestEndpoint` (camel-rest) and `PlatformHttpEndpoint` (camel-platform-http), in `setConsumes` / `setProduces`. Both now get valid media types; with platform-http-vertx server request validation, Vert.x was given `application/json;+charset=utf-8` before. - No change to `RestOpenApiEndpoint.createProducerFor`. The `consumes` / `produces` values that the `rest` endpoint uses come from `endpoint.configureProperties(params)` with the original strings, not from the `rest:` URI. So `RAW(...)` in that URI would only change the endpoint cache key. ## Tests - `MimeTypeHelperTest` (camel-util): new cases for spaces after `;` and around `=`, the `xslt xml` repair, several types, and quoted values with spaces, `,`, `;` and escaped quotes. camel-util: 356 tests, all pass. - New `RestOpenApiMediaTypeParametersTest` (camel-rest-openapi), for the 4 producers (http, vertx-http, undertow, netty-http): the headers sent to a WireMock server for types from the spec and from `consumes=RAW(application/vnd.api+json, application/json; q=0.5)`. It fails without the fix (`application/json;+q=0.5`). camel-rest-openapi: 244 tests, all pass. - camel-rest: 137 tests pass. camel-platform-http: 44 tests pass (1 skipped). camel-platform-http-vertx: 42 selected tests (rest-openapi, request validation, content type) pass. 🤖 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]
