(pathname: string, params: Record<string, unknown> = {})
| 497 | } |
| 498 | |
| 499 | async function baseRpcCall(pathname: string, params: Record<string, unknown> = {}) { |
| 500 | const response = await fetch(makeBaseUrl(pathname), { |
| 501 | method: 'POST', |
| 502 | headers: { |
| 503 | 'Content-Type': 'application/json', |
| 504 | }, |
| 505 | body: JSON.stringify(params), |
| 506 | }); |
| 507 | if (!response.ok) { |
| 508 | const error = await response.text(); |
| 509 | errorMessage.value = error; |
| 510 | throw new Error(error); |
| 511 | } |
| 512 | return response; |
| 513 | } |
| 514 | |
| 515 | const guestRpcCall: JsonRpcCall = (method, params) => baseRpcCall(`/guest/${method}`, params); |
| 516 |
no test coverage detected