bytesize instead of length

This commit is contained in:
Flummi 2023-05-03 00:30:36 +02:00
parent d57951a41d
commit 7f02123115
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "flummpress",
"version": "2.0.6",
"version": "2.0.7",
"description": "Express für arme",
"main": "src/index.mjs",
"repository": {

View File

@ -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;