tests: add a 200 HEAD test

purpose of this test is to explictly show how to send a 200 response
when a body is not expected (ie HEAD)
This commit is contained in:
Jonathan Ong 2013-11-19 11:11:26 -08:00
parent 28ca80758b
commit 16b016f61f

View file

@ -61,6 +61,34 @@ describe('app.respond', function(){
done(); done();
}); });
}) })
it('should respond with a 404 if no body was set', function(done){
var app = koa();
app.use(function *(){
this.status = 200;
})
var server = app.listen();
request(server)
.head('/')
.expect(404, done);
})
it('should respond with a 200 if body = ""', function(done){
var app = koa();
app.use(function *(){
this.body = '';
})
var server = app.listen();
request(server)
.head('/')
.expect(200, done);
})
}) })
describe('when no middleware are present', function(){ describe('when no middleware are present', function(){