1
0
Fork 0
forked from svrjs/svrjs

Replace ES5-style functions in code for sending data to a statistics server with ES6-style functions

This commit is contained in:
Dorian Niemiec 2024-08-26 10:03:51 +02:00
parent f403053c44
commit 686ec4924e

View file

@ -1008,13 +1008,13 @@ function listeningMessage() {
"Content-Length": Buffer.byteLength(statisticsToSend), "Content-Length": Buffer.byteLength(statisticsToSend),
}, },
}, },
function (res) { (res) => {
const statusCode = res.statusCode; const statusCode = res.statusCode;
let data = ""; let data = "";
res.on("data", function (chunk) { res.on("data", (chunk) => {
data += chunk.toString(); data += chunk.toString();
}); });
res.on("end", function () { res.on("end", () => {
try { try {
let parsedJson = {}; let parsedJson = {};
try { try {
@ -1036,7 +1036,7 @@ function listeningMessage() {
}); });
}, },
); );
statisticsRequest.on("error", function (err) { statisticsRequest.on("error", (err) => {
serverconsole.locwarnmessage( serverconsole.locwarnmessage(
"There was a problem, when sending data to statistics server! Reason: " + "There was a problem, when sending data to statistics server! Reason: " +
err.message, err.message,