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

Function toClientRequest

packages/effect/src/http/HttpServerRequest.ts:478–494  ·  view source on GitHub ↗
(request: HttpServerRequest)

Source from the content-addressed store, hash-verified

476 * @since 4.0.0
477 */
478export const toClientRequest = (request: HttpServerRequest): HttpClientRequest.HttpClientRequest => {
479 const body = toClientBody(request)
480 const headers = body._tag !== "Empty" && body.contentLength === undefined
481 ? Headers.remove(request.headers, "content-length")
482 : request.headers
483 return HttpClientRequest.setUrl(
484 HttpClientRequest.makeWith(
485 request.method,
486 "",
487 UrlParams.empty,
488 Option.none(),
489 headers,
490 body
491 ),
492 Option.getOrElse(toURL(request), () => request.url)
493 )
494}
495
496const toClientBody = (request: HttpServerRequest): HttpBody.HttpBody => {
497 if (!hasBody(request.method)) {

Callers

nothing calls this directly

Calls 3

toClientBodyFunction · 0.85
toURLFunction · 0.85
removeMethod · 0.65

Tested by

no test coverage detected