Fix case-sensitive Accept header comparison

## Motivation and Context

RFC 9110 defines media type comparison as case-insensitive,
but `parse_accept_header` compared types without normalizing case.
This caused `Application/JSON` or `TEXT/Event-Stream` to be rejected
with 406 Not Acceptable.

## How Has This Been Tested?

Added tests for mixed-case Accept headers:

- `Accept: Application/JSON, Text/Event-Stream` succeeds for POST
- `Accept: TEXT/EVENT-STREAM` succeeds for GET SSE

## Breaking Changes

None. This is a bug fix bringing behavior into conformance with RFC 9110.
This commit is contained in:
Koichi ITO 2026-05-23 21:24:57 +09:00
commit 9b89620257

View file

@ -504,7 +504,7 @@ module MCP
def parse_accept_header(header)
header.split(",").map do |part|
part.split(";").first.strip
part.split(";").first.strip.downcase
end
end