Use emp() when defining the sender
This commit is contained in:
parent
18bf274641
commit
934baa60b0
|
@ -17,7 +17,7 @@ http
|
|||
const isPost = req.method === "POST";
|
||||
|
||||
req.on("data", async (chunk) => {
|
||||
const sender = req.headers["user-agent"];
|
||||
const sender = emp(req.headers["user-agent"]);
|
||||
let data: Review[] = checkFile("data.json", "utf8");
|
||||
let temp: any;
|
||||
|
||||
|
@ -32,7 +32,7 @@ http
|
|||
.validate(temp)
|
||||
.then((valid) => {
|
||||
req.on("end", () => {
|
||||
logger.log(`${emp(sender)} sent: ${valid}`);
|
||||
logger.log(`${sender} sent: ${valid}`);
|
||||
|
||||
data.push(valid);
|
||||
fs.writeFileSync(
|
||||
|
@ -55,9 +55,9 @@ http
|
|||
});
|
||||
|
||||
req.on("end", () => {
|
||||
const sender = req.headers["user-agent"];
|
||||
const sender = emp(req.headers["user-agent"]);
|
||||
if (!isPost) {
|
||||
logger.log(`${emp(sender)} sent no data.`)
|
||||
logger.log(`${sender} sent no data.`)
|
||||
|
||||
res.writeHead(400, contentType);
|
||||
res.write(response.error("Invalid content-type"));
|
||||
|
|
Loading…
Reference in a new issue