add string HEAD support test

master
TJ Holowaychuk 2014-04-15 08:37:48 -07:00
parent 0a954c8d99
commit 9a45d07fea
1 changed files with 22 additions and 1 deletions

View File

@ -163,7 +163,7 @@ describe('app.respond', function(){
});
})
it('should keep the headers', function(done){
it('should keep json headers', function(done){
var app = koa();
app.use(function *(){
@ -184,6 +184,27 @@ describe('app.respond', function(){
});
})
it('should keep string headers', function(done){
var app = koa();
app.use(function *(){
this.body = 'hello world';
});
var server = app.listen();
request(server)
.head('/')
.expect(200)
.end(function(err, res){
if (err) return done(err);
res.should.have.header('Content-Type', 'text/plain; charset=utf-8');
res.should.have.header('Content-Length', '11');
assert(0 == res.text.length);
done();
});
})
it('should respond with a 404 if no body was set', function(done){
var app = koa();