(request: HttpServerRequest, body: unknown)
| 878 | } |
| 879 | |
| 880 | const rawBodyBytes = (request: HttpServerRequest, body: unknown): Effect.Effect<Uint8Array, HttpServerError> => { |
| 881 | if (body instanceof Request) { |
| 882 | return Effect.tryPromise({ |
| 883 | try: () => body.arrayBuffer().then((buffer) => new Uint8Array(buffer)), |
| 884 | catch: (cause) => requestParseError(request, undefined, cause) |
| 885 | }) |
| 886 | } |
| 887 | if (isBodyInit(body)) { |
| 888 | return bytesFromBodyInit(request, body) |
| 889 | } |
| 890 | return Effect.fail(requestParseError(request, "Unsupported body type")) |
| 891 | } |
| 892 | |
| 893 | const bytesFromBodyInit = (request: HttpServerRequest, body: BodyInit): Effect.Effect<Uint8Array, HttpServerError> => |
| 894 | Effect.tryPromise({ |
no test coverage detected