From 005cf121cbba2cf984d81b123f645987e750833e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Fri, 28 Jun 2024 12:33:10 +0100 Subject: [PATCH] fix: Close fetch response on HTTP broadcast sent (#412) Close fetch response on HTTP broadcast sent Co-authored-by: Stas --- src/RealtimeChannel.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/RealtimeChannel.ts b/src/RealtimeChannel.ts index 9ef2565..f1ab610 100644 --- a/src/RealtimeChannel.ts +++ b/src/RealtimeChannel.ts @@ -463,11 +463,8 @@ export default class RealtimeChannel { opts.timeout ?? this.timeout ) - if (response.ok) { - return 'ok' - } else { - return 'error' - } + await response.body?.cancel() + return response.ok ? 'ok' : 'error' } catch (error: any) { if (error.name === 'AbortError') { return 'timed out'