Node-restify: res.send can't send boolean false

Created on 25 Jun 2014  路  2Comments  路  Source: restify/node-restify

e.g:

res.send(200, true); //this will write true to response body

res.send(200, false); //this has no body in response

I just checked the source and found that
response.js, line 204:
if (body) {
var ret = this.format(body, _cb);
...
Against "res.send(200, false)", body is false, so there is no data to write back.

Question

Most helpful comment

Hi @lightma,
Try to put the boolean into JSON object, so it will look like this:

res.send(200, {"result": false})

All 2 comments

Hi @lightma,
Try to put the boolean into JSON object, so it will look like this:

res.send(200, {"result": false})

Great answer! thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mongris picture mongris  路  5Comments

nodesocket picture nodesocket  路  4Comments

sonnyp picture sonnyp  路  7Comments

nodesocket picture nodesocket  路  4Comments

danhstevens picture danhstevens  路  6Comments