Merge pull request #306 from koic/support_customizing_faraday_client_in_mcp_client_http
Support customizing the Faraday client in `MCP::Client::HTTP`
This commit is contained in:
commit
a05d941edd
1 changed files with 41 additions and 1 deletions
|
|
@ -7,9 +7,10 @@ module MCP
|
|||
|
||||
attr_reader :url
|
||||
|
||||
def initialize(url:, headers: {})
|
||||
def initialize(url:, headers: {}, &block)
|
||||
@url = url
|
||||
@headers = headers
|
||||
@faraday_customizer = block
|
||||
end
|
||||
|
||||
def send_request(request:)
|
||||
|
|
@ -78,6 +79,8 @@ module MCP
|
|||
headers.each do |key, value|
|
||||
faraday.headers[key] = value
|
||||
end
|
||||
|
||||
@faraday_customizer&.call(faraday)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue