Repository navigation
fix(server): match input modes on type and subtype, ignoring case - #1425
Merged
Iwaniukooo11 merged 2 commits intoNov 5, 2026
Merged
Conversation
validate_input_modes compared the part's media type with the card's input modes as exact strings, so Text/Plain or text/plain; charset=utf-8 was rejected by a card that declares text/plain. Media type names are case-insensitive (RFC 2045 section 5.1) and parameters do not change the type. Compare lower-cased type/subtype on both sides; the error still quotes what the client sent and what the card declares. Signed-off-by: Christopher Krah <[email protected]>
🧪 Code Coverage (vs
|
This was referenced Nov 13, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
validate_input_modes=True, a card that declarestext/plainrejects a part sent asText/Plainortext/plain; charset=utf-8, because the check compares exact strings. The spec defines input modes as media types, RFC 2045 section 5.1 makes type and subtype case-insensitive, and a charset parameter does not change the type.The validator now compares lower-cased
type/subtypeon both sides. The error still quotes what the client sent and what the card declares, andtext/html; charset=utf-8still fails againsttext/plain.a2aproject/a2a-js#745 still compares exact strings, so the two SDKs differ until it gets the same fix, which I can send there next.
@mykytanetipa a card that declares
image/*still only matches that literal string. I kept wildcards out, since that is a policy call on top of #1269 rather than a parsing fix. Would you rather have them handled here?CONTRIBUTINGGuide.bash scripts/format.shfrom the repository root to format)validate_input_modesdocstring now states the matching rule.Refs #1269. No issue exists, since the tests above reproduce it.