( nodeResponse: Http.ServerResponse, original: ServerResponse.HttpServerResponse )
| 494 | }) |
| 495 | |
| 496 | const handleCause = ( |
| 497 | nodeResponse: Http.ServerResponse, |
| 498 | original: ServerResponse.HttpServerResponse |
| 499 | ) => |
| 500 | <E>(originalCause: Cause.Cause<E>) => |
| 501 | Error.causeResponse(originalCause).pipe( |
| 502 | Effect.flatMap(([response, cause]) => { |
| 503 | const headersSent = nodeResponse.headersSent |
| 504 | if (!headersSent) { |
| 505 | nodeResponse.writeHead(response.status) |
| 506 | } |
| 507 | if (!nodeResponse.writableEnded) { |
| 508 | nodeResponse.end() |
| 509 | } |
| 510 | return Effect.failCause( |
| 511 | headersSent |
| 512 | ? Cause.sequential(originalCause, Cause.die(original)) |
| 513 | : cause |
| 514 | ) |
| 515 | }) |
| 516 | ) |
| 517 | |
| 518 | /** @internal */ |
| 519 | export const toIncomingMessage = (self: ServerRequest.HttpServerRequest): Http.IncomingMessage => |
no test coverage detected