Builds a Response-like object accepted by rxjs `fromFetch`.
(body: unknown, init?: { ok?: boolean; status?: number })
| 40 | |
| 41 | /** Builds a Response-like object accepted by rxjs `fromFetch`. */ |
| 42 | function jsonResponse(body: unknown, init?: { ok?: boolean; status?: number }) { |
| 43 | const ok = init?.ok ?? true; |
| 44 | return { |
| 45 | ok, |
| 46 | status: init?.status ?? (ok ? 200 : 500), |
| 47 | json: () => Promise.resolve(body), |
| 48 | } as unknown as Response; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Stub of the ambient {@link CopilotKit} service. Exposes the signals and the |
no test coverage detected
searching dependent graphs…