Permalink
Browse files

Merge pull request #25 from soplakanets/fix_res_send_without_arguments

Fix `res.send()` without arguments.
  • Loading branch information...
2 parents febefcb + fd995bc commit 60a727523e4724cbf79d4b30fd58cf65ad5801e3 @vkarpov15 vkarpov15 committed Aug 7, 2015
Showing with 12 additions and 1 deletion.
  1. +1 −1 index.js
  2. +11 −0 test/index.js
View
@@ -66,7 +66,7 @@ express.response.send = function expressmongoose_send () {
return args[0].exec(handleResult);
}
- if ('Object' == args[0].constructor.name) {
+ if (args[0] && 'Object' == args[0].constructor.name) {
return resolve(args[0], handleResult);
}
View
@@ -314,6 +314,10 @@ describe('express-mongoose', function(){
});
}
+ routes['/sendnothing'] = function(req, res) {
+ res.send();
+ }
+
test(routes, function (req) {
it('/sendquery', function(done){
req('/sendquery', function (res) {
@@ -389,6 +393,13 @@ describe('express-mongoose', function(){
done();
})
})
+
+ it('/sendnothing', function(done){
+ req('/sendnothing', function (res) {
+ assert.equal(res.statusCode, 200);
+ done();
+ })
+ })
})
})

0 comments on commit 60a7275

Please sign in to comment.