3 var express = require('..');
4 var request = require('supertest');
5 var utils = require('./support/utils');
7 describe('res.vary()', function(){
8 describe('with no arguments', function(){
9 it('should not set Vary', function (done) {
12 app.use(function (req, res) {
19 .expect(utils.shouldNotHaveHeader('Vary'))
24 describe('with an empty array', function(){
25 it('should not set Vary', function (done) {
28 app.use(function (req, res) {
35 .expect(utils.shouldNotHaveHeader('Vary'))
40 describe('with an array', function(){
41 it('should set the values', function (done) {
44 app.use(function (req, res) {
45 res.vary(['Accept', 'Accept-Language', 'Accept-Encoding']);
51 .expect('Vary', 'Accept, Accept-Language, Accept-Encoding')
56 describe('with a string', function(){
57 it('should set the value', function (done) {
60 app.use(function (req, res) {
67 .expect('Vary', 'Accept')
72 describe('when the value is present', function(){
73 it('should not add it again', function (done) {
76 app.use(function (req, res) {
78 res.vary('Accept-Encoding');
79 res.vary('Accept-Encoding');
80 res.vary('Accept-Encoding');
87 .expect('Vary', 'Accept, Accept-Encoding')