(headerArray: string[])
| 323 | } |
| 324 | |
| 325 | export function parseHeaders(headerArray: string[]): Record<string, string> { |
| 326 | const headers: Record<string, string> = {} |
| 327 | |
| 328 | for (const header of headerArray) { |
| 329 | const colonIndex = header.indexOf(':') |
| 330 | if (colonIndex === -1) { |
| 331 | throw new Error( |
| 332 | `Invalid header format: "${header}". Expected format: "Header-Name: value"`, |
| 333 | ) |
| 334 | } |
| 335 | |
| 336 | const key = header.substring(0, colonIndex).trim() |
| 337 | const value = header.substring(colonIndex + 1).trim() |
| 338 | |
| 339 | if (!key) { |
| 340 | throw new Error( |
| 341 | `Invalid header: "${header}". Header name cannot be empty.`, |
| 342 | ) |
| 343 | } |
| 344 | |
| 345 | headers[key] = value |
| 346 | } |
| 347 | |
| 348 | return headers |
| 349 | } |
| 350 | |
| 351 | export function getProjectMcpServerStatus( |
| 352 | serverName: string, |
no outgoing calls
no test coverage detected