(port: number, body: Record<string, unknown>)
| 403 | } |
| 404 | |
| 405 | async function postSessionApi(port: number, body: Record<string, unknown>) { |
| 406 | const response = await fetch(`http://127.0.0.1:${port}${HUNK_SESSION_API_PATH}`, { |
| 407 | method: "POST", |
| 408 | headers: { "content-type": "application/json" }, |
| 409 | body: JSON.stringify(body), |
| 410 | }); |
| 411 | |
| 412 | if (!response.ok) { |
| 413 | throw new Error( |
| 414 | `Session API ${body.action} failed: ${response.status} ${await response.text()}`, |
| 415 | ); |
| 416 | } |
| 417 | await response.arrayBuffer(); |
| 418 | } |
| 419 | |
| 420 | async function exerciseSessionApi(port: number, sessionIds: string[], requests: number) { |
| 421 | const actions = ["list", "context", "review", "comment-list"] as const; |
no test coverage detected