2013-11-14 03:59:49 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-12 04:59:30 +00:00
|
|
|
const response = require('../helpers/context').response;
|
2013-11-14 03:59:49 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('res.etag=', () => {
|
|
|
|
it('should not modify an etag with quotes', () => {
|
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"');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
2013-11-14 03:59:49 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
it('should not modify a weak etag', () => {
|
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"');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
2013-11-14 03:59:49 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
it('should add quotes around an etag if necessary', () => {
|
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"');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|
2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('res.etag', () => {
|
|
|
|
it('should return etag', () => {
|
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"');
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|