koa-lite/test/response/headers.js

21 lines
484 B
JavaScript
Raw Normal View History

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