MCPcopy
hub / github.com/OpenBMB/UltraRAG / parseResponse

Function parseResponse

ui/frontend/src/shared/api/http.ts:23–29  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

21}
22
23async function parseResponse<T>(response: Response): Promise<T> {
24 const contentType = response.headers.get("content-type") ?? "";
25 if (contentType.includes("application/json")) {
26 return (await response.json()) as T;
27 }
28 return (await response.text()) as unknown as T;
29}
30
31export class ApiHttpError extends Error {
32 status: number;

Callers 1

httpRequestFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected