(
&self,
url: String,
headers: Option<HashMap<String, String>>,
)
| 244 | Ok(()) |
| 245 | } |
| 246 | pub async fn connect_http( |
| 247 | &self, |
| 248 | url: String, |
| 249 | headers: Option<HashMap<String, String>>, |
| 250 | ) -> Result<(), McpClientError> { |
| 251 | let result = self.connect_http_inner(url, headers).await; |
| 252 | match &result { |
| 253 | Ok(()) => self.set_status(McpStatus::Connected).await, |
| 254 | Err(McpClientError::Unauthorized) => { |
| 255 | self.set_status(McpStatus::NeedsAuth).await; |
| 256 | } |
| 257 | Err(e) => { |
| 258 | let msg = e.to_string(); |
| 259 | if msg.contains("registration") || msg.contains("client_id") { |
| 260 | self.set_status(McpStatus::NeedsClientRegistration { error: msg }) |
| 261 | .await; |
| 262 | } else { |
| 263 | self.set_status(McpStatus::Failed { error: msg }).await; |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | result |
| 268 | } |
| 269 | |
| 270 | async fn connect_http_inner( |
| 271 | &self, |
no test coverage detected