express
Advanced tools
Comparing version 2.3.11 to 2.3.12
2.3.12 / 2011-06-22 | ||
================== | ||
* \#express is now on freenode! come join! | ||
* Added `req.get(field, param)` | ||
* Added links to Japanese documentation, thanks @hideyukisaito! | ||
* Added; the `express(1)` generated app outputs the env | ||
* Added `content-negotiation` example | ||
* Dependency: connect >= 1.5.1 < 2.0.0 | ||
* Fixed view layout bug. Closes #720 | ||
* Fixed; ignore body on 304. Closes #701 | ||
2.3.11 / 2011-06-04 | ||
@@ -3,0 +15,0 @@ ================== |
@@ -31,3 +31,3 @@ | ||
exports.version = '2.3.11'; | ||
exports.version = '2.3.12'; | ||
@@ -34,0 +34,0 @@ /** |
@@ -69,2 +69,24 @@ | ||
/** | ||
* Get `field`'s `param` value, defaulting to ''. | ||
* | ||
* Examples: | ||
* | ||
* req.get('content-disposition', 'filename'); | ||
* // => "something.png" | ||
* | ||
* @param {String} field | ||
* @param {String} param | ||
* @return {String} | ||
* @api public | ||
*/ | ||
req.get = function(field, param){ | ||
var val = this.header(field); | ||
if (!val) return ''; | ||
var regexp = new RegExp(param + ' *= *(?:"([^"]+)"|([^;]+))', 'i'); | ||
if (!regexp.exec(val)) return ''; | ||
return RegExp.$1 || RegExp.$2; | ||
}; | ||
/** | ||
* Check if the _Accept_ header is present, and includes the given `type`. | ||
@@ -110,5 +132,3 @@ * | ||
// allow "html" vs "text/html" etc | ||
if (type.indexOf('/') < 0) { | ||
type = mime.lookup(type); | ||
} | ||
if (!~type.indexOf('/')) type = mime.lookup(type); | ||
@@ -120,3 +140,3 @@ // check if we have a direct match | ||
type = type.split('/')[0] + '/*'; | ||
return accept.indexOf(type) >= 0; | ||
return !!~accept.indexOf(type); | ||
} else { | ||
@@ -123,0 +143,0 @@ return false; |
@@ -109,3 +109,3 @@ | ||
// strip irrelevant headers | ||
if (204 == status) { | ||
if (204 == status || 304 == status) { | ||
this.removeHeader('Content-Type'); | ||
@@ -194,3 +194,3 @@ this.removeHeader('Content-Length'); | ||
* and optional `fn2(err)` which is invoked when an error has | ||
* occurred after headers have been sent. | ||
* occurred after header has been sent. | ||
* | ||
@@ -365,5 +365,3 @@ * @param {String} path | ||
// Respect mount-point | ||
if (app.route) { | ||
url = join(app.route, url); | ||
} | ||
if (app.route) url = join(app.route, url); | ||
@@ -370,0 +368,0 @@ // Absolute |
@@ -96,5 +96,8 @@ | ||
exports.lookup = function(view, options){ | ||
var orig = view = new View(view, options); | ||
var orig = view = new View(view, options) | ||
, partial = options.isPartial | ||
, layout = options.isLayout; | ||
// Try _ prefix ex: ./views/_<name>.jade | ||
// taking precedence over the direct path | ||
if (partial) { | ||
@@ -106,7 +109,7 @@ view = new View(orig.prefixPath, options); | ||
// Try index ex: ./views/user/index.jade | ||
if (!view.exists) view = new View(orig.indexPath, options); | ||
if (!layout && !view.exists) view = new View(orig.indexPath, options); | ||
// Try ../<name>/index ex: ../user/index.jade | ||
// when calling partial('user') within the same dir | ||
if (!view.exists && !options.isLayout) view = new View(orig.upIndexPath, options); | ||
if (!layout && !view.exists) view = new View(orig.upIndexPath, options); | ||
@@ -167,3 +170,3 @@ // Try root ex: <root>/user.jade | ||
// Partials dont need layouts | ||
options.renderPartial = true; | ||
options.isPartial = true; | ||
options.layout = false; | ||
@@ -366,3 +369,3 @@ | ||
var partial = options.renderPartial | ||
var partial = options.isPartial | ||
, layout = options.layout; | ||
@@ -369,0 +372,0 @@ |
{ | ||
"name": "express", | ||
"description": "Sinatra inspired web development framework", | ||
"version": "2.3.11", | ||
"version": "2.3.12", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -13,3 +13,3 @@ "contributors": [ | ||
"dependencies": { | ||
"connect": ">= 1.4.1 < 2.0.0", | ||
"connect": ">= 1.5.1 < 2.0.0", | ||
"mime": ">= 0.0.1", | ||
@@ -16,0 +16,0 @@ "qs": ">= 0.0.6" |
@@ -78,2 +78,3 @@ | ||
* #express on freenode | ||
* [express-expose](http://github.com/visionmedia/express-expose) expose objects, functions, modules and more to client-side js with ease | ||
@@ -88,2 +89,3 @@ * [express-configure](http://github.com/visionmedia/express-configuration) async configuration support | ||
* Visit the [Wiki](http://github.com/visionmedia/express/wiki) | ||
* [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito) | ||
* Screencast - [Introduction](http://bit.ly/eRYu0O) | ||
@@ -90,0 +92,0 @@ * Screencast - [View Partials](http://bit.ly/dU13Fx) |
Sorry, the diff of this file is not supported yet
104794
2425
144
Updatedconnect@>= 1.5.1 < 2.0.0