Skip to content

Commit

Permalink
fix(express): do not crash on null body. fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Jul 19, 2024
1 parent 449eeb1 commit 0766257
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/adapter-express/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export async function sendResponse(
const fetchBody: unknown = fetchResponse.body;

let body: Readable | null = null;
if (typeof (fetchBody as any).pipe === "function") {
if (!fetchBody) {
body = null;
} else if (typeof (fetchBody as any).pipe === "function") {
body = fetchBody as Readable;
} else if (typeof (fetchBody as any).pipeTo === "function") {
if (!deno && Readable.fromWeb) {
Expand Down

0 comments on commit 0766257

Please sign in to comment.