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

Function copyResponse

packages/effect/src/http/HttpServerResponse.ts:1519–1533  ·  view source on GitHub ↗
(
  self: HttpServerResponse,
  status: number,
  statusText: string | undefined,
  cookies: Cookies.Cookies,
  body: Body.HttpBody
)

Source from the content-addressed store, hash-verified

1517// Shares the headers of `self`, so explicit content headers are not replaced
1518// with the body's.
1519const copyResponse = (
1520 self: HttpServerResponse,
1521 status: number,
1522 statusText: string | undefined,
1523 cookies: Cookies.Cookies,
1524 body: Body.HttpBody
1525): HttpServerResponse => {
1526 const response = Object.create(Proto) as Mutable<HttpServerResponse>
1527 response.status = status
1528 response.statusText = statusText
1529 response.cookies = cookies
1530 response.body = body
1531 response.headers = self.headers
1532 return response
1533}
1534
1535/**
1536 * Converts a Web `Response` to an `HttpServerResponse`.

Callers 2

setBodyKeepHeadersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected