From 419c373b3d45d39e7f85e2597963065b605bf6d7 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 9 Jan 2025 09:51:03 +0000 Subject: [PATCH 1/2] chore: better types --- packages/astro/src/core/request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index 289920403240..e35ca2b743b4 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -8,14 +8,14 @@ type RequestBody = | ReadableStream | URLSearchParams | FormData - | ReadableStream; + | Request['body']; export interface CreateRequestOptions { url: URL | string; clientAddress?: string | undefined; headers: HeaderType; method?: string; - body?: RequestBody | undefined | null; + body?: RequestBody | undefined; logger: Logger; locals?: object | undefined; /** From b58eb3738d8807f69929a884a2d2c81983e4b362 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 9 Jan 2025 14:46:32 +0000 Subject: [PATCH 2/2] apply suggestion --- packages/astro/src/core/request.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index e35ca2b743b4..5e646bb8959d 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -2,20 +2,13 @@ import type { IncomingHttpHeaders } from 'node:http'; import type { Logger } from './logger/core.js'; type HeaderType = Headers | Record | IncomingHttpHeaders; -type RequestBody = - | ArrayBuffer - | Blob - | ReadableStream - | URLSearchParams - | FormData - | Request['body']; export interface CreateRequestOptions { url: URL | string; clientAddress?: string | undefined; headers: HeaderType; method?: string; - body?: RequestBody | undefined; + body?: RequestInit['body']; logger: Logger; locals?: object | undefined; /**