Skip to content
Myr

patch.js

This file

Path

lib/patch.js

41 lines · 782 bytes · JavaScript

Last changed by

remove .writeHead patchJonathan Ongbefore adoption74f55a8

History of this file

Take it

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

lines 1–31why, one step back
1/*!
2 * Connect3 * Copyright(c) 2011 TJ Holowaychuk4 * MIT Licensed5 */67/**8 * Module dependencies.9 */1011var http = require('http');12var ServerResponse = http.ServerResponse;1314// apply only once15if (ServerResponse.prototype._hasConnectPatch) {16 return;17}1819// original methods20var setHeader = ServerResponse.prototype.setHeader;2122/**23 * Set header `field` to `val`, special-casing24 * the `Set-Cookie` field for multiple support.25 *26 * @param {String} field27 * @param {String} val28 * @api public29 */3031ServerResponse.prototype.setHeader = function(field, val){

move support for multiple `res.cookie` calls to lib/responseRoman Shtylmanbefore adoptiond42d8f5

line 32why, one step back
32 var key = field.toLowerCase();

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

line 33why, one step back
33

move support for multiple `res.cookie` calls to lib/responseRoman Shtylmanbefore adoptiond42d8f5

line 34why, one step back
34 if ('content-type' == key && this.charset) {

remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08

lines 35–41why, one step back
35 val += '; charset=' + this.charset;
36 }3738 return setHeader.call(this, field, val);39};4041ServerResponse.prototype._hasConnectPatch = true;