Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Allow &pretty to show prettified-JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Oct 28, 2016
1 parent 31bd864 commit e4bdd81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/src/reactrender.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ exports.render = function (req, res, page) {
staticLinkWithHost: req.staticLinkWithHost
}, serverModel);
if (req.query.data == "json") {
res.type("json").send(jsonModel);
if (req.query.pretty !== undefined) {
res.type("json").send(JSON.stringify(jsonModel, null, ' '));
} else {
res.type("json").send(jsonModel);
}
return;
}
let head = ReactDOMServer.renderToStaticMarkup(viewModule.HeadFactory(serverModel));
Expand Down

0 comments on commit e4bdd81

Please sign in to comment.