From c33fa625230c4c01ec51482747cf6b5812e224ea Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Thu, 18 Jul 2024 12:29:55 +0200 Subject: [PATCH] Improve info --- app.js | 9 +++++++-- app.test.js | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index a47d3f9..752a847 100644 --- a/app.js +++ b/app.js @@ -54,8 +54,13 @@ app.use(express.static("public")) app.get("/info", (req, res) => { res.json({ - cloudflare: req.headers["cf-ipcountry"] !== undefined, - maxmind: lookup.metadata.buildEpoch.toISOString().substring(0, 10), + cloudflare: { + enabled: req.headers["cf-ipcountry"] !== undefined, + }, + maxmind: { + enabled: true, + build: lookup.metadata.buildEpoch.toISOString().substring(0, 10), + }, }) }) diff --git a/app.test.js b/app.test.js index 8c972b0..9d645fc 100644 --- a/app.test.js +++ b/app.test.js @@ -114,12 +114,12 @@ describe("GET /info", () => { it("returns maxmind", async () => { const res = await req - expect(res.body.maxmind).toBeDefined() + expect(res.body.maxmind.enabled).toBeTruthy() }) it("returns cloudflare", async () => { const res = await req.set("cf-ipcountry", "DE") - expect(res.body.cloudflare).toBeTruthy() + expect(res.body.cloudflare.enabled).toBeTruthy() }) it("sets cache-control to public", async () => {