Merge commit '36c66dd290d3ce6eb1ccd310d0c658d4a32bb8eb' as 'repos/effect'

This commit is contained in:
-Puter
2026-07-19 03:25:18 +05:30
parent dd1071cc10
commit 2daf979036
2214 changed files with 673090 additions and 0 deletions
@@ -0,0 +1,33 @@
/**
* Accessors for the Node.js objects behind an Effect HTTP server request.
*
* `toIncomingMessage` returns the underlying Node `http.IncomingMessage`.
* `toServerResponse` returns the underlying Node `http.ServerResponse`,
* evaluating the stored response thunk when the response was created lazily.
*
* @since 4.0.0
*/
import type { HttpServerRequest } from "effect/unstable/http/HttpServerRequest"
import type * as Http from "node:http"
/**
* Returns the underlying Node `IncomingMessage` for a platform Node
* `HttpServerRequest`.
*
* @category accessors
* @since 4.0.0
*/
export const toIncomingMessage = (self: HttpServerRequest): Http.IncomingMessage => self.source as any
/**
* Returns the underlying Node `ServerResponse` for a platform Node
* `HttpServerRequest`, evaluating the stored response thunk when the response
* was created lazily.
*
* @category accessors
* @since 4.0.0
*/
export const toServerResponse = (self: HttpServerRequest): Http.ServerResponse => {
const res = (self as any).response
return typeof res === "function" ? res() : res
}