From fb9e3e34babbe4b5682637fe50b83a410d592d96 Mon Sep 17 00:00:00 2001 From: Valentin Dzhankhotov Date: Mon, 10 Jul 2023 15:14:32 +0300 Subject: [PATCH] fix(proxy): handle responses with no content (#433) --- src/utils/proxy.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/proxy.ts b/src/utils/proxy.ts index 03949ca2..2fffe2d3 100644 --- a/src/utils/proxy.ts +++ b/src/utils/proxy.ts @@ -134,8 +134,10 @@ export async function sendProxy( } // Send as stream - for await (const chunk of response.body as any as AsyncIterable) { - event.node.res.write(chunk); + if (response.body) { + for await (const chunk of response.body as any as AsyncIterable) { + event.node.res.write(chunk); + } } return event.node.res.end(); }