Extract and store session ID from response headers.
(&self, headers: &reqwest::header::HeaderMap)
| 115 | |
| 116 | /// Extract and store session ID from response headers. |
| 117 | async fn capture_session_id(&self, headers: &reqwest::header::HeaderMap) { |
| 118 | if let Some(val) = headers.get("Mcp-Session-Id") { |
| 119 | if let Ok(s) = val.to_str() { |
| 120 | let mut sid = self.session_id.write().await; |
| 121 | *sid = Some(s.to_string()); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /// Parse a JSON-RPC response from either plain JSON or SSE stream body. |
| 127 | async fn parse_response(response: reqwest::Response) -> Result<JsonRpcResponse> { |