* Best-effort DELETE to release the streamable-HTTP session the probe just * allocated. Reuses the probe's pinned fetch so this cleanup hop stays pinned. * Failures are ignored — the session will expire on the server side.
( url: string, sessionId: string, probeFetch: FetchLike )
| 94 | * Failures are ignored — the session will expire on the server side. |
| 95 | */ |
| 96 | async function closeMcpSession( |
| 97 | url: string, |
| 98 | sessionId: string, |
| 99 | probeFetch: FetchLike |
| 100 | ): Promise<void> { |
| 101 | try { |
| 102 | const controller = new AbortController() |
| 103 | const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS) |
| 104 | try { |
| 105 | await probeFetch(url, { |
| 106 | method: 'DELETE', |
| 107 | headers: { 'Mcp-Session-Id': sessionId }, |
| 108 | signal: controller.signal, |
| 109 | }) |
| 110 | } finally { |
| 111 | clearTimeout(timer) |
| 112 | } |
| 113 | } catch { |
| 114 | // Ignore — best-effort cleanup |
| 115 | } |
| 116 | } |
no test coverage detected