From e24334e820b5c1ae5ad7e84625d1215f1a733270 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Tue, 20 Aug 2013 21:30:55 -0700 Subject: [PATCH] add test for 304 as well --- test/context.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/context.js b/test/context.js index cf3cc54..9f94fe7 100644 --- a/test/context.js +++ b/test/context.js @@ -174,7 +174,7 @@ describe('ctx.status=', function(){ }) }) - describe('when 204', function(){ + function strip(status) { it('should strip content related header fields', function(done){ var app = koa(); @@ -183,7 +183,7 @@ describe('ctx.status=', function(){ this.set('Content-Type', 'application/json'); this.set('Content-Length', '15'); this.set('Transfer-Encoding', 'chunked'); - this.status = 204; + this.status = status; assert(null == this.responseHeader['content-type']); assert(null == this.responseHeader['content-length']); assert(null == this.responseHeader['transfer-encoding']); @@ -192,9 +192,17 @@ describe('ctx.status=', function(){ request(app.listen()) .get('/') - .expect(204) + .expect(status) .end(done); }) + } + + describe('when 204', function(){ + strip(204); + }) + + describe('when 304', function(){ + strip(304); }) })