koa-lite/test/response/etag.js
2013-11-13 19:59:49 -08:00

28 lines
No EOL
694 B
JavaScript

var response = require('../response');
describe('res.etag', function(){
it('should not modify an etag with quotes', function(){
var res = response();
res.etag = '"asdf"';
res.header.etag.should.equal('"asdf"');
})
it('should not modify a weak etag', function(){
var res = response();
res.etag = 'W/"asdf"';
res.header.etag.should.equal('W/"asdf"');
})
it('should add quotes around an etag if necessary', function(){
var res = response();
res.etag = 'asdf';
res.header.etag.should.equal('"asdf"');
})
it('should get the etag', function(){
var res = response();
res.set('etag', '"asdf"');
res.etag.should.equal('"asdf"');
})
})