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

Function toClientBody

packages/effect/src/unstable/http/HttpServerRequest.ts:439–451  ·  view source on GitHub ↗
(request: HttpServerRequest)

Source from the content-addressed store, hash-verified

437 )
438
439const toClientBody = (request: HttpServerRequest): HttpBody.HttpBody => {
440 if (!hasBody(request.method)) {
441 return HttpBody.empty
442 }
443 const formData = getFormDataBody(request)
444 return formData === undefined
445 ? HttpBody.stream(
446 request.stream,
447 request.headers["content-type"],
448 parseContentLength(request.headers["content-length"])
449 )
450 : HttpBody.formData(formData)
451}
452
453const parseContentLength = (contentLength: string | undefined): number | undefined => {
454 if (contentLength === undefined) {

Callers 1

toClientRequestFunction · 0.85

Calls 5

hasBodyFunction · 0.90
getFormDataBodyFunction · 0.85
parseContentLengthFunction · 0.70
streamMethod · 0.65
formDataMethod · 0.45

Tested by

no test coverage detected