From 4e44c1c49effb426a56764df0eab186152aafb98 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Tue, 15 Apr 2014 08:38:32 -0700 Subject: [PATCH] add buffer HEAD support tests --- test/application.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/application.js b/test/application.js index 52ba891..dc2a4b1 100644 --- a/test/application.js +++ b/test/application.js @@ -205,6 +205,27 @@ describe('app.respond', function(){ }); }) + it('should keep buffer headers', function(done){ + var app = koa(); + + app.use(function *(){ + this.body = new Buffer('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', 'application/octet-stream'); + 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();