| 815 | |
| 816 | private bytesEffect: Effect.Effect<Uint8Array, HttpServerError> | undefined |
| 817 | private get bytes(): Effect.Effect<Uint8Array, HttpServerError> { |
| 818 | if (this.bytesEffect) { |
| 819 | return this.bytesEffect |
| 820 | } |
| 821 | this.bytesEffect = Effect.withFiber((fiber) => { |
| 822 | const maxBodySize = fiber.getRef(HttpIncomingMessage.MaxBodySize) |
| 823 | return this.readBytes(maxBodySize === undefined ? undefined : Number(maxBodySize)) |
| 824 | }).pipe( |
| 825 | Effect.cached, |
| 826 | Effect.runSync |
| 827 | ) |
| 828 | return this.bytesEffect |
| 829 | } |
| 830 | |
| 831 | private readBytes(maxBytes: number | undefined): Effect.Effect<Uint8Array, HttpServerError> { |
| 832 | const body = this.source.body |