summaryrefslogtreecommitdiff
path: root/packages/astro/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/src')
-rw-r--r--packages/astro/src/vite-plugin-astro-server/index.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/astro/src/vite-plugin-astro-server/index.ts b/packages/astro/src/vite-plugin-astro-server/index.ts
index 5d46d463c..05e82a226 100644
--- a/packages/astro/src/vite-plugin-astro-server/index.ts
+++ b/packages/astro/src/vite-plugin-astro-server/index.ts
@@ -215,13 +215,14 @@ async function handleRequest(
let body: ArrayBuffer | undefined = undefined;
if (!(req.method === 'GET' || req.method === 'HEAD')) {
- let bytes: string[] = [];
+ let bytes: Uint8Array[] = [];
await new Promise((resolve) => {
- req.setEncoding('utf-8');
- req.on('data', (bts) => bytes.push(bts));
+ req.on('data', part => {
+ bytes.push(part);
+ });
req.on('end', resolve);
});
- body = new TextEncoder().encode(bytes.join('')).buffer;
+ body = Buffer.concat(bytes);
}
// Headers are only available when using SSR.