(url: string, payload: unknown)
| 117 | }; |
| 118 | |
| 119 | const postJson = async (url: string, payload: unknown): Promise<unknown> => { |
| 120 | const response = await fetch(url, { |
| 121 | method: "POST", |
| 122 | headers: { "content-type": "application/json" }, |
| 123 | body: JSON.stringify(payload), |
| 124 | }); |
| 125 | const bodyText = await response.text(); |
| 126 | if (!response.ok) { |
| 127 | throw new Error(`POST ${url} failed with HTTP ${response.status}: ${bodyText}`); |
| 128 | } |
| 129 | return bodyText.length > 0 ? JSON.parse(bodyText) : null; |
| 130 | }; |
| 131 | |
| 132 | const firstScope = (value: unknown): { readonly id: string; readonly name: string } => { |
| 133 | const data = toolData<{ |
no test coverage detected