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

Function rawBodyStream

packages/effect/src/http/HttpServerRequest.ts:939–950  ·  view source on GitHub ↗
(request: HttpServerRequest, body: unknown)

Source from the content-addressed store, hash-verified

937}
938
939const rawBodyStream = (request: HttpServerRequest, body: unknown): Stream.Stream<Uint8Array, HttpServerError> => {
940 if (body instanceof Request) {
941 return streamFromReadable(request, body.body)
942 }
943 if (isReadableStream(body)) {
944 return streamFromReadable(request, body)
945 }
946 if (isBodyInit(body)) {
947 return streamFromReadable(request, new Response(body).body)
948 }
949 return Stream.fail(requestParseError(request, "Unsupported body type"))
950}
951
952const rawBodyBytes = (
953 request: HttpServerRequest,

Callers 1

streamMethod · 0.85

Calls 5

streamFromReadableFunction · 0.85
isBodyInitFunction · 0.85
requestParseErrorFunction · 0.85
isReadableStreamFunction · 0.70
failMethod · 0.65

Tested by

no test coverage detected