| 362 | } |
| 363 | |
| 364 | get stream(): Stream.Stream<Uint8Array, Error.HttpServerError> { |
| 365 | return this.source.body |
| 366 | ? Stream.fromReadableStream({ |
| 367 | evaluate: () => this.source.body ?? emptyReadableStream, |
| 368 | onError: (cause) => |
| 369 | new Error.HttpServerError({ |
| 370 | reason: new Error.RequestParseError({ request: this, cause }) |
| 371 | }) |
| 372 | }) |
| 373 | : Stream.fail( |
| 374 | new Error.HttpServerError({ |
| 375 | reason: new Error.RequestParseError({ |
| 376 | request: this, |
| 377 | description: "can not create stream from empty body" |
| 378 | }) |
| 379 | }) |
| 380 | ) |
| 381 | } |
| 382 | |
| 383 | private textEffect: Effect.Effect<string, Error.HttpServerError> | undefined |
| 384 | get text(): Effect.Effect<string, Error.HttpServerError> { |