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