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

Function fromWebBody

packages/effect/src/unstable/http/HttpClientRequest.ts:903–911  ·  view source on GitHub ↗
(request: globalThis.Request, method: HttpMethod)

Source from the content-addressed store, hash-verified

901}
902
903const fromWebBody = (request: globalThis.Request, method: HttpMethod): HttpBody.HttpBody => {
904 if (!hasBody(method) || request.body === null) {
905 return HttpBody.empty
906 }
907 return HttpBody.raw(request.body, {
908 contentType: request.headers.get("content-type") ?? undefined,
909 contentLength: parseContentLength(request.headers.get("content-length"))
910 })
911}
912
913const parseContentLength = (contentLength: string | null): number | undefined => {
914 if (contentLength === null) {

Callers 1

fromWebFunction · 0.85

Calls 4

hasBodyFunction · 0.90
rawMethod · 0.80
parseContentLengthFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected