2013-11-14 03:59:49 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-05 18:23:47 +00:00
|
|
|
const response = require('../context').response;
|
2013-11-14 03:59:49 +00:00
|
|
|
|
2014-07-06 08:43:14 +00:00
|
|
|
describe('res.etag=', function(){
|
2013-11-14 03:59:49 +00:00
|
|
|
it('should not modify an etag with quotes', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2013-11-14 03:59:49 +00:00
|
|
|
res.etag = '"asdf"';
|
|
|
|
res.header.etag.should.equal('"asdf"');
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should not modify a weak etag', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2013-11-14 03:59:49 +00:00
|
|
|
res.etag = 'W/"asdf"';
|
|
|
|
res.header.etag.should.equal('W/"asdf"');
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should add quotes around an etag if necessary', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2013-11-14 03:59:49 +00:00
|
|
|
res.etag = 'asdf';
|
|
|
|
res.header.etag.should.equal('"asdf"');
|
|
|
|
})
|
2014-07-06 08:43:14 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('res.etag', function(){
|
|
|
|
it('should return etag', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const res = response();
|
2014-07-06 08:43:14 +00:00
|
|
|
res.etag = '"asdf"';
|
|
|
|
res.etag.should.equal('"asdf"');
|
|
|
|
})
|
|
|
|
})
|