MCPcopy Index your code
hub / github.com/simstudioai/sim / readResponseBody

Function readResponseBody

apps/sim/lib/api/client/request.ts:126–135  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

124}
125
126async function readResponseBody(response: Response): Promise<{ parsed: unknown; raw?: string }> {
127 const text = await response.text()
128 if (!text) return { parsed: undefined }
129
130 try {
131 return { parsed: JSON.parse(text) as unknown, raw: text }
132 } catch {
133 return { parsed: text, raw: text }
134 }
135}
136
137function messageFromErrorBody(body: unknown, fallback: string): string {
138 if (body && typeof body === 'object') {

Callers 2

requestJsonFunction · 0.85
requestRawFunction · 0.85

Calls 2

textMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected