chore(http): create constant for session id header#246
Open
EdouardCourty wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
chore(http): create constant for session id header#246EdouardCourty wants to merge 1 commit intomodelcontextprotocol:mainfrom
EdouardCourty wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
chr-hertel
reviewed
Feb 22, 2026
| */ | ||
| class StreamableHttpTransport extends BaseTransport | ||
| { | ||
| public const MCP_SESSION_ID_HEADER = 'Mcp-Session-Id'; |
Member
There was a problem hiding this comment.
let's not reuse the const in tests, and only go with private scope - maybe shorter as well?
Suggested change
| public const MCP_SESSION_ID_HEADER = 'Mcp-Session-Id'; | |
| private const SESSION_HEADER = 'Mcp-Session-Id'; |
chr-hertel
reviewed
Feb 22, 2026
| 'Access-Control-Allow-Methods' => 'GET, POST, DELETE, OPTIONS', | ||
| 'Access-Control-Allow-Headers' => 'Content-Type, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID, Authorization, Accept', | ||
| 'Access-Control-Expose-Headers' => 'Mcp-Session-Id', | ||
| 'Access-Control-Allow-Headers' => 'Content-Type, '.self::MCP_SESSION_ID_HEADER.', Mcp-Protocol-Version, Last-Event-ID, Authorization, Accept', |
Member
There was a problem hiding this comment.
what about introducing a const here as well?
private const ALLOWED_HEADER = [
'Accept',
'Authorization',
'Content-Type',
'Last-Event-ID',
'Mcp-Protocol-Version',
self::SESSION_HEADER,
];in combination with:
Suggested change
| 'Access-Control-Allow-Headers' => 'Content-Type, '.self::MCP_SESSION_ID_HEADER.', Mcp-Protocol-Version, Last-Event-ID, Authorization, Accept', | |
| 'Access-Control-Allow-Headers' => implode(',', self::ALLOWED_HEADER), |
chr-hertel
requested changes
Feb 22, 2026
Member
chr-hertel
left a comment
There was a problem hiding this comment.
Thanks @EdouardCourty - small adjustments. In general I'm not in favor of having too much coupling of code between tests and implementation - rather a nit pick, i know 👼
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.
Motivation and Context
The
Mcp-Session-Idvalue is re-written a few times in the codebase. It should be stored in a constant to avoid duplication.How Has This Been Tested?
Tests are passing.
Breaking Changes
No behavioral or API change.
Types of changes
Checklist
Additional context