Add requestModifier property to HTTPClientTransport#152
Merged
Conversation
Co-authored-by: Tim Wang <tim.wang@ing.com>
4c8af27 to
73650d2
Compare
d4bbe3b to
7d83d86
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds a requestModifier property to the HTTPClientTransport class to enable custom modification of HTTP requests before they are sent. This allows for adding authentication headers, custom headers, or other request modifications without subclassing.
- Added
requestModifierparameter toHTTPClientTransportinitializers with a default no-op implementation - Applied the request modifier in both the
sendmethod and SSE connection setup - Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/MCP/Base/Transports/HTTPClientTransport.swift | Added requestModifier property and parameter to initializers, applied modifier in request methods |
| Tests/MCPTests/HTTPClientTransportTests.swift | Added test for request modifier functionality and improved test setup ordering |
Comments suppressed due to low confidence (1)
Tests/MCPTests/HTTPClientTransportTests.swift:535
- This #endif directive appears to be incorrectly removed. The corresponding #if condition likely still exists above this line, creating unbalanced conditional compilation directives.
}
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.
Alternative to #149, as discussed in #149 (comment)