MCPcopy Create free account
hub / github.com/Effect-TS/effect / convert

Function convert

packages/ui/native/src/NativeHttpClient.ts:153–168  ·  view source on GitHub ↗
(body: any)

Source from the content-addressed store, hash-verified

151let nextId = 0x40000000
152
153const convert = (body: any): object | undefined =>
154 body == null
155 ? {}
156 : typeof body === "string"
157 ? { string: body }
158 : body instanceof ArrayBuffer || ArrayBuffer.isView(body)
159 ? {
160 base64: Base64.encode(
161 ArrayBuffer.isView(body)
162 ? new Uint8Array(body.buffer, body.byteOffset, body.byteLength)
163 : new Uint8Array(body)
164 )
165 }
166 : typeof body.getParts === "function"
167 ? { formData: body.getParts() }
168 : undefined
169
170const client = HttpClient.make((request, url, signal, fiber) => {
171 const transportError = (cause: unknown) =>

Callers 1

Calls 2

encodeMethod · 0.80
getPartsMethod · 0.80

Tested by

no test coverage detected