Skip to content

Commit cd16c54

Browse files
committed
fix: do not pretty-print json by default
1 parent fbe407e commit cd16c54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class Web {
9595
sessionKeys: process.env.SESSION_KEYS
9696
? process.env.SESSION_KEYS.split(',')
9797
: ['lad'],
98+
prettyPrintedJSON: process.env.PRETTY_PRINTED_JSON
99+
? Boolean(process.env.PRETTY_PRINTED_JSON)
100+
: false,
98101
cookiesKey: process.env.COOKIES_KEY || 'lad.sid',
99102
favicon: {
100103
path: path.resolve('./assets/img/favicon.ico'),
@@ -376,7 +379,8 @@ class Web {
376379
app.use(bodyParser());
377380

378381
// pretty-printed json responses
379-
app.use(json());
382+
// (default unless in development/test environment)
383+
app.use(json({ pretty: this.config.prettyPrintedJSON, param: 'pretty' }));
380384

381385
// method override
382386
// (e.g. `<input type="hidden" name="_method" value="PUT" />`)

0 commit comments

Comments
 (0)