add test for 304 as well

This commit is contained in:
TJ Holowaychuk 2013-08-20 21:30:55 -07:00
parent 1457a3df0f
commit e24334e820

View file

@ -174,7 +174,7 @@ describe('ctx.status=', function(){
}) })
}) })
describe('when 204', function(){ function strip(status) {
it('should strip content related header fields', function(done){ it('should strip content related header fields', function(done){
var app = koa(); var app = koa();
@ -183,7 +183,7 @@ describe('ctx.status=', function(){
this.set('Content-Type', 'application/json'); this.set('Content-Type', 'application/json');
this.set('Content-Length', '15'); this.set('Content-Length', '15');
this.set('Transfer-Encoding', 'chunked'); this.set('Transfer-Encoding', 'chunked');
this.status = 204; this.status = status;
assert(null == this.responseHeader['content-type']); assert(null == this.responseHeader['content-type']);
assert(null == this.responseHeader['content-length']); assert(null == this.responseHeader['content-length']);
assert(null == this.responseHeader['transfer-encoding']); assert(null == this.responseHeader['transfer-encoding']);
@ -192,9 +192,17 @@ describe('ctx.status=', function(){
request(app.listen()) request(app.listen())
.get('/') .get('/')
.expect(204) .expect(status)
.end(done); .end(done);
}) })
}
describe('when 204', function(){
strip(204);
})
describe('when 304', function(){
strip(304);
}) })
}) })