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

Function rawBodyBytes

packages/effect/src/http/HttpServerRequest.ts:952–964  ·  view source on GitHub ↗
(
  request: HttpServerRequest,
  body: unknown,
  maxBytes: number | undefined
)

Source from the content-addressed store, hash-verified

950}
951
952const rawBodyBytes = (
953 request: HttpServerRequest,
954 body: unknown,
955 maxBytes: number | undefined
956): Effect.Effect<Uint8Array, HttpServerError> => {
957 if (body instanceof Request) {
958 return bytesFromWeb(request, () => body, maxBytes)
959 }
960 if (isBodyInit(body)) {
961 return bytesFromWeb(request, () => new Response(body), maxBytes)
962 }
963 return Effect.fail(requestParseError(request, "Unsupported body type"))
964}
965
966const bytesFromWeb = (
967 request: HttpServerRequest,

Callers 1

readBytesMethod · 0.85

Calls 4

bytesFromWebFunction · 0.85
isBodyInitFunction · 0.85
requestParseErrorFunction · 0.85
failMethod · 0.65

Tested by

no test coverage detected