Skip to content
Myr

Fixed status()

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

authored by visionmedia · committed by visionmedia · parent 2a7cdd4 · Browse files · 2 files+50 added−23 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+50 added−23 removed

  • tests:+41 added−0 removed
  • other:+9 added−23 removed

2 files+50 added−23 removed

modified:lib/express.core.js+9 added-23 removed
4 unmodified lines
5 routes : [],6 response : {7 body : null,8 status : 200,9 headers : {},10 statuses : {11 'ok' : 200,12 'created' : 201,13 'accepted' : 202,14 'no content' : 204,15 'reset content' : 205,16 'partial content' : 206,17 'moved permanently' : 301,18 'found' : 302,19 'see other' : 303,20 'not modified' : 304,21 'use proxy' : 305,22 'switch proxy' : 306,23 'temporary redirect' : 307,24 'bad request' : 400,25 'unauthorized' : 401,26 'forbidden' : 403,27 'not found' : 40428 }9 headers : {}10 },11 12 defaultRoute : {13 callback : function() {
46 unmodified lines
60 */61 62 hashToArray : function(hash) {63 var array = []83 for (key in hash)64 for (var key in hash)65 if (hash.hasOwnProperty(key))66 array.push([key, hash[key]])67 return array68 },
19 unmodified lines
88 * a case-insensitive string such as 'Not Found', 'forbidden',89 * or a numeric HTTP response status code.90 *91 * @param {int, string} value92 * @return {int}93 * @api public94 */95 96 status : function(value) {115 this.response.status = this.response.statuses[value.toString().toLowerCase()] || value97 if (typeof value == 'number') return this.response.status = value98 for (var code in node.http.STATUS_CODES)99 if (node.http.STATUS_CODES.hasOwnProperty(code))100 if (node.http.STATUS_CODES[code].toLowerCase() == value.toLowerCase())101 return this.response.status = code102 },103 104 /**105 * Sets _name_ header to _value_. When _value_
24 unmodified lines
130 return this.request.uri.params[key] || defaultValue131 },132 133 parseNestedParams : function(params) {148 for (key in params)134 for (var key in params)135 if (params.hasOwnProperty(key))136 if (parts = key.split('['))137 if (parts.length > 1)138 for (i = 0, prop = params, len = parts.length; i < len; ++i) {
203 unmodified lines
modified:spec/spec.core.js+41 added