diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-12-13 14:13:38 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-12-13 14:13:38 +0200 |
commit | 9d2094bc20af37d4373c16084e6d607a347c5910 (patch) | |
tree | ad74ff70cf545dbdb981725508d971c7c7738761 | |
parent | 171d790e4492dc3063cd7874ce45a68ce8cf3665 (diff) | |
download | arching-kaos-tools-9d2094bc20af37d4373c16084e6d607a347c5910.tar.gz arching-kaos-tools-9d2094bc20af37d4373c16084e6d607a347c5910.tar.bz2 arching-kaos-tools-9d2094bc20af37d4373c16084e6d607a347c5910.zip |
Wrong function call fixed
-rw-r--r-- | api/routes/getChunk/index.js | 6 | ||||
-rw-r--r-- | api/routes/getLeaf/index.js | 6 | ||||
-rw-r--r-- | api/routes/getMap/index.js | 6 |
3 files changed, 12 insertions, 6 deletions
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 diff --git a/api/routes/getLeaf/index.js b/api/routes/getLeaf/index.js index 593d52a..54df1e0 100644 --- a/api/routes/getLeaf/index.js +++ b/api/routes/getLeaf/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 diff --git a/api/routes/getMap/index.js b/api/routes/getMap/index.js index fa834ab..60c7e0d 100644 --- a/api/routes/getMap/index.js +++ b/api/routes/getMap/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 |