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

Function convertBody

packages/platform/node/src/NodeHttpClient.ts:179–197  ·  view source on GitHub ↗
(
  body: Body.HttpBody
)

Source from the content-addressed store, hash-verified

177})
178
179function convertBody(
180 body: Body.HttpBody
181): Effect.Effect<Exclude<Undici.Dispatcher.DispatchOptions["body"], undefined>> {
182 switch (body._tag) {
183 case "Empty": {
184 return Effect.succeed(null)
185 }
186 case "Uint8Array":
187 case "Raw": {
188 return Effect.succeed(body.body as Uint8Array)
189 }
190 case "FormData": {
191 return Effect.succeed(body.formData as any)
192 }
193 case "Stream": {
194 return NodeStream.toReadable(body.stream)
195 }
196 }
197}
198
199function noopErrorHandler(_: any) {}
200

Callers 1

NodeHttpClient.tsFile · 0.85

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected