koa-lite/test/response/header.js

21 lines
498 B
JavaScript
Raw Normal View History

'use strict';
const response = require('../helpers/context').response;
describe('res.header', function(){
it('should return the response header object', function(){
const res = response();
res.set('X-Foo', 'bar');
res.header.should.eql({ 'x-foo': 'bar' });
2015-10-12 20:36:41 +00:00
});
2014-10-01 12:42:29 +00:00
2015-10-12 20:36:41 +00:00
describe('when res._headers not present', function(){
it('should return empty object', function(){
const res = response();
2014-10-01 12:42:29 +00:00
res.res._headers = null;
res.header.should.eql({});
2015-10-12 20:36:41 +00:00
});
});
});