handle undefined body

This commit is contained in:
Spencer Pogorzelski 2023-08-14 18:32:03 -07:00
parent b73a561844
commit 055f120271

View file

@ -20,7 +20,7 @@ const NULL_BODY_STATUSES = [101, 103, 204, 205, 304];
function createBodyStream(
body: BodyInit | null
): ReadableStream<ArrayBuffer | Uint8Array> | null {
if (body === null) return null;
if (body === null || typeof body === "undefined") return null;
if (typeof body === "string") {
body = new TextEncoder().encode(body);