From 201e67c4f14dfeb06910a66af94a63166223db60 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 24 Mar 2020 14:12:03 +0900 Subject: [PATCH] feat: pretty response format --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 45e4891..8324486 100644 --- a/index.js +++ b/index.js @@ -4,9 +4,8 @@ const app = express(); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(express.raw({ type: "*/*" })); +app.set("json spaces", 2); app.all("/*", function(req, res) { - app.set("json spaces", req.path === "/pretty" ? 2 : null); - res.json({ headers: req.headers, body: req.body.length > 0 ? req.body.toString() : null,