azat-co / expressworks

Learn Express.js from the author of one of the best books on Express.js—Pro Express.js— with this workshop that will teach you basics of Express.js.
MIT License
709 stars 220 forks source link

JSON me: Official solution fails #125

Open JohnnyBizzel opened 7 years ago

JohnnyBizzel commented 7 years ago
             ACTUAL                                 EXPECTED                

────────────────────────────────────────────────────────────────────────────────

"[" != "[{\"title\":\"Express.js Guide\",\"tags\":[\"node.js\",\"express.js\"],\"url\":\"http://expressjsguide.com\"},{\"title\":\"Rapid Prototyping with JS\",\"tags\":[\"backbone.js\",\"node.js\",\"mongodb\"],\"url\":\"http://rpjs.co\"},{\"title\":\"JavaScript: The Good Parts\",\"tags\":[\"javascript\"]}]" " \"title\": \"Express.js Guide\"," !=
" \"tags\": [" !=
" \"node.js\"," !=
" \"express.js\"" !=
" ]," !=
" \"url\": \"http://expressjsguide.com\"" !=
" }," !=
" {" !=
" \"title\": \"Rapid Prototyping with JS\"," !=
" \"tags\": [" !=
" \"backbone.js\"," !=
" \"node.js\"," !=
" \"mongodb\"" !=
" ]," !=
" \"url\": \"http://rpjs.co\"" !=
" }," !=
" {" !=
" \"title\": \"JavaScript: The Good Parts\"," !=
" \"tags\": [" !=
" \"javascript\"" !=
" ]" !=
" }" !=
"]" !=

Ethicmeta commented 7 years ago

For those interested, the work around is to change the res.json(obj) to res.end(JSON.stringify(obj));

the result is a string without the formatting which causes the test case to fail.