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:
parent
28ca80758b
commit
16b016f61f
1 changed files with 28 additions and 0 deletions
|
@ -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(){
|
||||||
|
|
Loading…
Reference in a new issue