MCPcopy
hub / github.com/Effect-TS/effect / prepareBody

Function prepareBody

packages/ai/amazon-bedrock/src/AmazonBedrockClient.ts:299–316  ·  view source on GitHub ↗
(body: HttpBody.HttpBody)

Source from the content-addressed store, hash-verified

297}
298
299const prepareBody = (body: HttpBody.HttpBody): string => {
300 switch (body._tag) {
301 case "Raw":
302 case "Uint8Array": {
303 if (typeof body.body === "string") {
304 return body.body
305 }
306 if (body.body instanceof Uint8Array) {
307 return new TextDecoder().decode(body.body)
308 }
309 if (body.body instanceof ArrayBuffer) {
310 return new TextDecoder().decode(body.body)
311 }
312 return JSON.stringify(body.body)
313 }
314 }
315 throw new Error("Unsupported HttpBody: " + body._tag)
316}

Callers 1

makeFunction · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected