feat: add support for custom HTTP headers in StreamableHttpClient (#655)
* feat: add support for custom HTTP headers in StreamableHttpClient * feat: implement reserved header checks for custom HTTP headers in StreamableHttpClient
This commit is contained in:
parent
70f6380b48
commit
016b7d3bfa
1 changed files with 622 additions and 8 deletions
|
|
@ -16,6 +16,8 @@ use thiserror::Error;
|
|||
use tokio::sync::{Mutex, RwLock};
|
||||
use tracing::{debug, error, warn};
|
||||
|
||||
use crate::transport::common::http_header::HEADER_MCP_PROTOCOL_VERSION;
|
||||
|
||||
const DEFAULT_EXCHANGE_URL: &str = "http://localhost";
|
||||
|
||||
/// Stored credentials for OAuth2 authorization
|
||||
|
|
@ -1068,7 +1070,7 @@ impl AuthorizationManager {
|
|||
let response = match self
|
||||
.http_client
|
||||
.get(discovery_url.clone())
|
||||
.header("MCP-Protocol-Version", "2024-11-05")
|
||||
.header(HEADER_MCP_PROTOCOL_VERSION, "2024-11-05")
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
|
|
@ -1188,7 +1190,7 @@ impl AuthorizationManager {
|
|||
let response = match self
|
||||
.http_client
|
||||
.get(url.clone())
|
||||
.header("MCP-Protocol-Version", "2024-11-05")
|
||||
.header(HEADER_MCP_PROTOCOL_VERSION, "2024-11-05")
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
|
|
@ -1241,7 +1243,7 @@ impl AuthorizationManager {
|
|||
let response = match self
|
||||
.http_client
|
||||
.get(resource_metadata_url.clone())
|
||||
.header("MCP-Protocol-Version", "2024-11-05")
|
||||
.header(HEADER_MCP_PROTOCOL_VERSION, "2024-11-05")
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue