Skip to content
Myr

use vary@0.1.0

Before adoption: this commit came in with the history the project adopted, so no landing records it.

with backwards compatibility closes #2161

authored by Jonathan Ong · committed by Douglas Christopher Wilson · parent c919b4a · Browse files · 3 files+10 added−22 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−22 removed

  • other:+10 added−22 removed

3 files+10 added−22 removed

modified:lib/response.js+4 added-22 removed
1 unmodified line
2 * Module dependencies.3 */45var escapeHtml = require('escape-html');6var vary = require('vary');7var http = require('http')8 , path = require('path')9 , connect = require('connect')10 , utils = connect.utils
759 unmodified lines
770 * @api public771 */772773res.vary = function(field){773 var self = this;774775 // nothing774 // checks for back-compat775 if (!field) return this;776 if (Array.isArray(field) && !field.length) return this;777778 // array779 if (Array.isArray(field)) {780 field.forEach(function(field){781 self.vary(field);782 });783 return;784 }778 vary(this, field);779786 var vary = this.get('Vary');787788 // append789 if (vary) {790 vary = vary.split(/ *, */);791 if (!~vary.indexOf(field)) vary.push(field);792 this.set('Vary', vary.join(', '));793 return this;794 }795796 // set797 this.set('Vary', field);780 return this;781};782783/**
38 unmodified lines
modified:History.md+5 added
13.x2===34 * use `vary` module for `res.vary`563.10.2 / 2014-06-037===================89 * deps: connect@2.19.3
1401 unmodified lines
modified:package.json+1 added