pjfanning opened a new pull request, #1905: URL: https://github.com/apache/pekko-connectors/pull/1905
### Motivation `PekkoHttpClient.tryCreateCustomContentType` split content-type values only on `/`, so a value with parameters (e.g. `text/plain; charset=UTF-8`) produced a custom binary media type whose subtype embedded the parameters (`plain; charset=UTF-8`) instead of a properly modeled `ContentType`. The `contentTypeMap` also carried an entry keyed `"application/x-www-form-urlencoded; charset-UTF-8"` (typo: `-` instead of `=`); the key is unreachable either way, because the lookup value is the re-rendered parsed `Content-Type` header, and pekko-http renders the fixed-charset form-urlencoded media type without a charset parameter. ### Modification - `tryCreateCustomContentType` now tries `ContentType.parse` first and only falls back to the legacy `/`-split custom binary media type when proper parsing fails. - Removed the unreachable typo'd map entry, with a comment explaining why no charset-suffixed key is needed. ### Result Content-type values with parameters keep their parameters in the request entity's `ContentType`; unparseable values retain the previous fallback behavior; no behavior change for the mapped AWS content types (`x-amz-json`, `x-amz-cbor`, etc.). ### Tests - `sbt "aws-spi-pekko-http/Test/testOnly org.apache.pekko.stream.connectors.awsspi.PekkoHttpClientSpec"` — 14 passed, 3 new tests: parameters preservation (fails without the fix — verified by reverting the main source), legacy fallback retention, and a characterization test that a parsed form-urlencoded header with an explicit charset still maps via the bare key - `sbt "aws-spi-pekko-http/mimaReportBinaryIssues"` — no issues - `scalafmt --mode diff-ref=origin/main` — clean; no Java files changed, no new files (no header changes needed) ### References None - found during a review of the aws-spi-pekko-http client 🤖 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
