2013-11-24 13:06:35 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2013-11-24 13:06:35 +00:00
|
|
|
var context = require('../context');
|
2018-02-12 08:43:13 +00:00
|
|
|
var should = require('should');
|
2013-11-24 13:06:35 +00:00
|
|
|
|
|
|
|
describe('ctx.remove(name)', function(){
|
|
|
|
it('should remove a field', function(){
|
|
|
|
var ctx = context();
|
|
|
|
ctx.set('x-foo', 'bar');
|
|
|
|
ctx.remove('x-foo');
|
|
|
|
ctx.response.header.should.eql({});
|
|
|
|
})
|
2018-02-12 08:43:13 +00:00
|
|
|
|
|
|
|
describe('after header sent', function(){
|
|
|
|
it('should ignore', function(){
|
|
|
|
var ctx = context();
|
|
|
|
ctx.set('foo', 'bar');
|
|
|
|
ctx.res.headersSent = true;
|
|
|
|
ctx.remove('foo', 'bar');
|
|
|
|
ctx.response.header.foo.should.equal('bar');
|
|
|
|
})
|
|
|
|
})
|
2013-11-24 13:06:35 +00:00
|
|
|
})
|