Skip to content
Myr

Header fields case insensitive

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

authored by visionmedia · committed by visionmedia · parent 1da8234 · Browse files · 2 files+15 added−4 removed
This commit

State

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

Diff stats

2 files+15 added−4 removed

  • tests:+11 added−1 removed
  • other:+4 added−3 removed

2 files+15 added−4 removed

modified:lib/express.core.js+4 added-3 removed
185 unmodified lines
186 187 arrayToHash : function(array) {188 var hash = {}189 for (i = 0, len = array.length; i < len; ++i)190 hash[array[i][0]] = array[i][1]190 hash[array[i][0].toLowerCase()] = array[i][1]191 return hash192 },193 194 /**
47 unmodified lines
242 if (typeof value == 'number') return this.response.status = value243 for (var code in node.http.STATUS_CODES)244 if (node.http.STATUS_CODES.hasOwnProperty(code))245 if (node.http.STATUS_CODES[code].toLowerCase() == value.toLowerCase())246 return this.response.status = code246 return this.response.status = parseInt(code)247 },248 249 /**250 * Set response _status_ and _body_.
18 unmodified lines
269 * @api public270 */271 272 header : function(name, value) {273 name = name.toLowerCase()274 return value ? this.response.headers[name] = value :275 this.request.headers[name] || this.response.headers[name]276 },277
199 unmodified lines
477 if (!route.options.provides) return true478 if (route.options.provides.constructor != Array) 479 route.options.provides = [route.options.provides]480 for (i = 0, len = route.options.provides.length; i < len; ++i)480 if (request.headers['Accept'].match(route.options.provides[i]))481 if (request.headers.accept.match(route.options.provides[i]))482 return true483 return false484 },485
100 unmodified lines
modified:spec/spec.core.js+11 added-1 removed