From 9d2094bc20af37d4373c16084e6d607a347c5910 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 13 Dec 2024 14:13:38 +0200 Subject: Wrong function call fixed --- api/routes/getChunk/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'api/routes/getChunk/index.js') diff --git a/api/routes/getChunk/index.js b/api/routes/getChunk/index.js index d848ce9..031d2c8 100644 --- a/api/routes/getChunk/index.js +++ b/api/routes/getChunk/index.js @@ -18,12 +18,14 @@ module.exports = (req, res) => { { if(fs.existsSync(path)) { - res.send(fs.readFileSync(path)); + res.writeHead(200, {'Content-Type': 'application/json'}); + res.end(fs.readFileSync(path)); } } catch (error) { - res.send({"error":error.message}); + res.writeHead(404, {'Content-Type': 'application/json'}); + res.end(JSON.stringify({"error":error.message})); } } else -- cgit v1.2.3