MCPcopy Index your code
hub / github.com/Effect-TS/effect / toURL

Function toURL

packages/platform/src/internal/httpServerRequest.ts:364–372  ·  view source on GitHub ↗
(self: ServerRequest.HttpServerRequest)

Source from the content-addressed store, hash-verified

362
363/** @internal */
364export const toURL = (self: ServerRequest.HttpServerRequest): Option.Option<URL> => {
365 const host = self.headers.host ?? "localhost"
366 const protocol = self.headers["x-forwarded-proto"] === "https" ? "https" : "http"
367 try {
368 return Option.some(new URL(self.url, `${protocol}://${host}`))
369 } catch {
370 return Option.none()
371 }
372}

Callers 1

toWebEitherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected