MCPcopy
hub / github.com/Effect-TS/effect / fromWeb

Function fromWeb

packages/platform/src/HttpServerResponse.ts:404–428  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

402 * @category conversions
403 */
404export const fromWeb = (response: Response): HttpServerResponse => {
405 const headers = new globalThis.Headers(response.headers)
406 const setCookieHeaders = headers.getSetCookie()
407 headers.delete("set-cookie")
408 let self = empty({
409 status: response.status,
410 statusText: response.statusText,
411 headers: headers as any,
412 cookies: Cookies.fromSetCookie(setCookieHeaders)
413 })
414 if (response.body) {
415 const contentType = headers.get("content-type")
416 self = setBody(
417 self,
418 Body.stream(
419 Stream.fromReadableStream({
420 evaluate: () => response.body!,
421 onError: (e) => e
422 }),
423 contentType ?? undefined
424 )
425 )
426 }
427 return self
428}

Callers

nothing calls this directly

Calls 3

getMethod · 0.65
emptyFunction · 0.50
streamMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…