Skip to content

Commit

Permalink
Added res.send(bool) support
Browse files Browse the repository at this point in the history
application/json
  • Loading branch information
tj committed Mar 21, 2011
1 parent c1b72ac commit b7232f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/response.js
Expand Up @@ -67,6 +67,7 @@ res.send = function(body, headers, status){
this.contentType('.html');
}
break;
case 'boolean':
case 'object':
if (Buffer.isBuffer(body)) {
if (!this.header('Content-Type')) {
Expand Down
11 changes: 10 additions & 1 deletion test/response.test.js
Expand Up @@ -49,7 +49,16 @@ module.exports = {
app.get('/noargs', function(req, res, next){
res.send();
});


app.get('/bool', function(req, res, next){
res.send(true);
});

assert.response(app,
{ url: '/bool' },
{ body: 'true'
, headers: { 'Content-Type': 'application/json' }});

assert.response(app,
{ url: '/html' },
{ body: '<p>test</p>'
Expand Down

0 comments on commit b7232f3

Please sign in to comment.