Alanxtl opened a new issue, #3405: URL: https://github.com/apache/dubbo-go/issues/3405
## Background `protocol/triple/triple_protocol.canonicalizeContentType` already has a fast path for simple lowercase content types, but common values with parameters such as `application/json; charset=utf-8` still fall back to `mime.ParseMediaType` and `mime.FormatMediaType`. This path is used while handling Triple/gRPC request content types, so avoiding the slow parser for the common cases can reduce small per-request allocations. ## Scope Add explicit fast paths for common content types that are already in canonical form or only need trivial charset normalization. Keep the slow path for uncommon or malformed values. Relevant code: - `protocol/triple/triple_protocol/protocol.go` - `canonicalizeContentType` - `canonicalizeContentTypeSlow` ## Acceptance Criteria - Existing content-type behavior remains unchanged. - Add or update tests covering common fast-path values and slow-path fallback values. - Add or update benchmarks for simple content type, charset content type, and non-charset parameter content type. - `go test ./protocol/triple/triple_protocol` passes. -- 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]
