Skip to content

Fix case-sensitive Accept header comparison#359

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:case_insensitive_accept_header
May 23, 2026
Merged

Fix case-sensitive Accept header comparison#359
koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:case_insensitive_accept_header

Conversation

@koic
Copy link
Copy Markdown
Member

@koic koic commented May 23, 2026

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.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

## 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.
@koic koic merged commit dd7daca into modelcontextprotocol:main May 23, 2026
11 checks passed
@koic koic deleted the case_insensitive_accept_header branch May 23, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants