From 7f02123115d0864a08150929118a8d302959825f Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 3 May 2023 00:30:36 +0200 Subject: [PATCH] bytesize instead of length --- package.json | 2 +- src/index.mjs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 046bf3f..e9d1adf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flummpress", - "version": "2.0.6", + "version": "2.0.7", "description": "Express für arme", "main": "src/index.mjs", "repository": { diff --git a/src/index.mjs b/src/index.mjs index 9403222..aabecdc 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -1,5 +1,6 @@ import http from "http"; import { URL } from "url"; +import { Buffer } from "buffer"; import querystring from "querystring"; import Router from "./router.mjs"; @@ -110,7 +111,7 @@ export default class flummpress { }) => { res.writeHead(code, { "content-type": `${type}; charset=UTF-8`, - "content-length": body.length + "content-length": Buffer.byteLength(body, 'utf-8') }); if(res.method === 'HEAD') body = null;