Comparar commits
29 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| ce2bcaef68 | |||
| 0db7f26ad3 | |||
| 35370da458 | |||
| fe6c5832c2 | |||
| e8c32df79c | |||
| 652e166462 | |||
| af6385f8e4 | |||
| f0277d3777 | |||
| 6bb100d7fa | |||
| f13ea34de3 | |||
| 48a14a443a | |||
| 1820ea6f59 | |||
| 4d9647923e | |||
| 943e9b3a28 | |||
| 6b2ec50a0b | |||
| 7b813b95b6 | |||
| cdaa2e78d7 | |||
| add53d3222 | |||
| f4f79d2217 | |||
| aa36bc4516 | |||
| 9028cacfd1 | |||
| 40ccb595cd | |||
| 5606d08ecb | |||
| 1888d6fca1 | |||
| 5d16e6b302 | |||
| 96f7574bc1 | |||
| 490584c8bc | |||
| 0cbb1f661c | |||
| 3dc53e105a |
@@ -1,4 +1,16 @@
|
||||
|
||||
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
|
||||
==================
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ The following are the major contributors of Express (in no specific order).
|
||||
|
||||
## More Information
|
||||
|
||||
* #express on freenode
|
||||
* [express-expose](http://github.com/visionmedia/express-expose) expose objects, functions, modules and more to client-side js with ease
|
||||
* [express-configure](http://github.com/visionmedia/express-configuration) async configuration support
|
||||
* [express-messages](http://github.com/visionmedia/express-messages) flash notification rendering helper
|
||||
@@ -84,6 +85,7 @@ The following are the major contributors of Express (in no specific order).
|
||||
* Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
|
||||
* [Google Group](http://groups.google.com/group/express-js) for discussion
|
||||
* 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)
|
||||
* Screencast - [View Partials](http://bit.ly/dU13Fx)
|
||||
* Screencast - [Route Specific Middleware](http://bit.ly/hX4IaH)
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ var fs = require('fs')
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
var version = '2.3.11';
|
||||
var version = '2.3.12';
|
||||
|
||||
/**
|
||||
* Add session support.
|
||||
@@ -191,7 +191,7 @@ var app = [
|
||||
, '});'
|
||||
, ''
|
||||
, 'app.listen(3000);'
|
||||
, 'console.log("Express server listening on port %d", app.address().port);'
|
||||
, 'console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
|
||||
, ''
|
||||
].join('\n');
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
|
||||
+16
-2
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
@@ -202,6 +203,7 @@
|
||||
<li><a href="#req.accepts()">accepts()</a></li>
|
||||
<li><a href="#req.is()">is()</a></li>
|
||||
<li><a href="#req.param()">param()</a></li>
|
||||
<li><a href="#req.get()">get()</a></li>
|
||||
<li><a href="#req.flash()">flash()</a></li>
|
||||
<li><a href="#req.isxmlhttprequest">isXMLHttpRequest</a></li>
|
||||
</ul></li>
|
||||
@@ -931,14 +933,14 @@ app.use(express.session({ secret: "keyboard cat" }));
|
||||
|
||||
<p>By default the <em>session</em> middleware uses the memory store bundled with Connect, however many implementations exist. For example <a href="http://github.com/visionmedia/connect-redis">connect-redis</a> supplies a <a href="http://code.google.com/p/redis/">Redis</a> session store and can be used as shown below:</p>
|
||||
|
||||
<pre><code>var RedisStore = require('connect-redis');
|
||||
<pre><code>var RedisStore = require('connect-redis')(express);
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
|
||||
</code></pre>
|
||||
|
||||
<p>Now the <em>req.session</em> and <em>req.sessionStore</em> properties will be accessible to all routes and subsequent middleware. Properties on <em>req.session</em> are automatically saved on a response, so for example if we wish to shopping cart data:</p>
|
||||
|
||||
<pre><code>var RedisStore = require('connect-redis');
|
||||
<pre><code>var RedisStore = require('connect-redis')(express);
|
||||
app.use(express.bodyParser());
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
|
||||
@@ -1082,6 +1084,18 @@ can perform any request assertion you wish.</p>
|
||||
should be an object. This can be done by using
|
||||
the _express.bodyParser middleware.</p>
|
||||
|
||||
<h3 id="req.get()">req.get(field, param)</h3>
|
||||
|
||||
<p> Get <em>field</em>’s <em>param</em> value, defaulting to ‘’ when the <em>param</em>
|
||||
or <em>field</em> is not present.</p>
|
||||
|
||||
<pre><code> req.get('content-disposition', 'filename');
|
||||
// => "something.png"
|
||||
|
||||
req.get('Content-Type', 'boundary');
|
||||
// => "--foo-bar-baz"
|
||||
</code></pre>
|
||||
|
||||
<h3 id="req.flash()">req.flash(type[, msg])</h3>
|
||||
|
||||
<p>Queue flash <em>msg</em> of the given <em>type</em>.</p>
|
||||
|
||||
+13
-2
@@ -615,13 +615,13 @@ Sessions support can be added by using Connect's _session_ middleware. To do so
|
||||
|
||||
By default the _session_ middleware uses the memory store bundled with Connect, however many implementations exist. For example [connect-redis](http://github.com/visionmedia/connect-redis) supplies a [Redis](http://code.google.com/p/redis/) session store and can be used as shown below:
|
||||
|
||||
var RedisStore = require('connect-redis');
|
||||
var RedisStore = require('connect-redis')(express);
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
|
||||
|
||||
Now the _req.session_ and _req.sessionStore_ properties will be accessible to all routes and subsequent middleware. Properties on _req.session_ are automatically saved on a response, so for example if we wish to shopping cart data:
|
||||
|
||||
var RedisStore = require('connect-redis');
|
||||
var RedisStore = require('connect-redis')(express);
|
||||
app.use(express.bodyParser());
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
|
||||
@@ -753,6 +753,17 @@ To utilize urlencoded request bodies, _req.body_
|
||||
should be an object. This can be done by using
|
||||
the _express.bodyParser middleware.
|
||||
|
||||
### req.get(field, param)
|
||||
|
||||
Get _field_'s _param_ value, defaulting to '' when the _param_
|
||||
or _field_ is not present.
|
||||
|
||||
req.get('content-disposition', 'filename');
|
||||
// => "something.png"
|
||||
|
||||
req.get('Content-Type', 'boundary');
|
||||
// => "--foo-bar-baz"
|
||||
|
||||
### req.flash(type[, msg])
|
||||
|
||||
Queue flash _msg_ of the given _type_.
|
||||
|
||||
+12
-6
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
@@ -239,19 +240,24 @@ app.listen(3000);
|
||||
<li><a href="http://github.com/visionmedia/express-messages">express-messages</a> flash message notification rendering</li>
|
||||
<li><a href="http://github.com/visionmedia/express-configuration">express-configure</a> async configuration support (load settings from redis etc)</li>
|
||||
<li><a href="http://github.com/visionmedia/express-namespace">express-namespace</a> namespaced routing support</li>
|
||||
<li><a href="http://github.com/visionmedia/express-expose">express-expose</a> expose objects, functions, modules and more to client-side js</li>
|
||||
<li><a href="https://github.com/visionmedia/express-params">express-params</a> app.param() extensions</li>
|
||||
<li><a href="https://github.com/LearnBoost/express-mongoose">express-mongoose</a> plugin for easy rendering of Mongoose async Query results</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>More Information</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://groups.google.com/group/express-js">Google Group</a> for discussion</li>
|
||||
<li>#express on freenode</li>
|
||||
<li>Follow <a href="http://twitter.com/tjholowaychuk">tjholowaychuk</a> on twitter for updates</li>
|
||||
<li>View the <a href="http://senchalabs.github.com/connect">Connect</a> documentation</li>
|
||||
<li>View the <a href="http://wiki.github.com/senchalabs/connect/">Connect Wiki</a> for contrib middleware</li>
|
||||
<li>View the <a href="http://github.com/visionmedia/express/tree/master/examples/">examples</a></li>
|
||||
<li>View the <a href="http://github.com/visionmedia/express">source</a></li>
|
||||
<li>View the <a href="contrib.html">contrib guide</a></li>
|
||||
<li><a href="http://groups.google.com/group/express-js">Google Group</a> for discussion</li>
|
||||
<li>Visit the <a href="http://github.com/visionmedia/express/wiki">Wiki</a></li>
|
||||
<li><a href="http://hideyukisaito.com/doc/expressjs/">日本語ドキュメンテーション</a> by <a href="https://github.com/hideyukisaito">hideyukisaito</a></li>
|
||||
<li>Screencast – <a href="http://bit.ly/eRYu0O">Introduction</a></li>
|
||||
<li>Screencast – <a href="http://bit.ly/dU13Fx">View Partials</a></li>
|
||||
<li>Screencast – <a href="http://bit.ly/hX4IaH">Route Specific Middleware</a></li>
|
||||
<li>Screencast – <a href="http://bit.ly/eNqmVs">Route Path Placeholder Preconditions</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
+7
-6
@@ -40,13 +40,14 @@ The following modules compliment or extend Express directly:
|
||||
* [express-messages](http://github.com/visionmedia/express-messages) flash message notification rendering
|
||||
* [express-configure](http://github.com/visionmedia/express-configuration) async configuration support (load settings from redis etc)
|
||||
* [express-namespace](http://github.com/visionmedia/express-namespace) namespaced routing support
|
||||
* [express-expose](http://github.com/visionmedia/express-expose) expose objects, functions, modules and more to client-side js
|
||||
* [express-params](https://github.com/visionmedia/express-params) app.param() extensions
|
||||
* [express-mongoose](https://github.com/LearnBoost/express-mongoose) plugin for easy rendering of Mongoose async Query results
|
||||
|
||||
## More Information
|
||||
|
||||
* [Google Group](http://groups.google.com/group/express-js) for discussion
|
||||
* \#express on freenode
|
||||
* Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
|
||||
* View the [Connect](http://senchalabs.github.com/connect) documentation
|
||||
* View the [Connect Wiki](http://wiki.github.com/senchalabs/connect/) for contrib middleware
|
||||
* View the [examples](http://github.com/visionmedia/express/tree/master/examples/)
|
||||
* View the [source](http://github.com/visionmedia/express)
|
||||
* View the [contrib guide](contrib.html)
|
||||
* [Google Group](http://groups.google.com/group/express-js) for discussion
|
||||
* Visit the [Wiki](http://github.com/visionmedia/express/wiki)
|
||||
* [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
@@ -326,7 +327,7 @@
|
||||
|
||||
<h3>partial() locals</h3>
|
||||
|
||||
<p> Both <em>res.partial()</em> and the <em>partial()</em> functions accept an single object consisting of both the options and the locals. Previously with Express 1.x you may pass <em>user</em> to a partial, along with <em>date</em> like so:</p>
|
||||
<p> Both <em>res.partial()</em> and the <em>partial()</em> functions accept a single object consisting of both the options and the locals. Previously with Express 1.x you may pass <em>user</em> to a partial, along with <em>date</em> like so:</p>
|
||||
|
||||
<pre><code> partial('user', { object: user, locals: { date: new Date }})
|
||||
</code></pre>
|
||||
@@ -367,7 +368,7 @@
|
||||
|
||||
<h3>View Partial Lookup</h3>
|
||||
|
||||
<p> Previously partials were loaded relative to the now removed <em>view partials</em> directory setting, or by default <em>views/partials</em>, now they are relative to the view calling them, read more on <a href="guide.html#View-Lookup">view lookup</a>.</p>
|
||||
<p> Previously partials were loaded relative to the now removed <em>view partials</em> directory setting, or by default <em>views/partials</em>, now they are relative to the view calling them, read more on <a href="guide.html#view-lookup">view lookup</a>.</p>
|
||||
|
||||
<h3>Mime Types</h3>
|
||||
|
||||
|
||||
+3
-3
@@ -123,7 +123,7 @@ However now we have the alternative _maxAge_ property which may be used to set _
|
||||
|
||||
### partial() locals
|
||||
|
||||
Both _res.partial()_ and the _partial()_ functions accept an single object consisting of both the options and the locals. Previously with Express 1.x you may pass _user_ to a partial, along with _date_ like so:
|
||||
Both _res.partial()_ and the _partial()_ functions accept a single object consisting of both the options and the locals. Previously with Express 1.x you may pass _user_ to a partial, along with _date_ like so:
|
||||
|
||||
partial('user', { object: user, locals: { date: new Date }})
|
||||
|
||||
@@ -157,7 +157,7 @@ or perhaps if you preferred not to use the inferred name _user_ you may used a l
|
||||
|
||||
### View Partial Lookup
|
||||
|
||||
Previously partials were loaded relative to the now removed _view partials_ directory setting, or by default _views/partials_, now they are relative to the view calling them, read more on [view lookup](guide.html#View-Lookup).
|
||||
Previously partials were loaded relative to the now removed _view partials_ directory setting, or by default _views/partials_, now they are relative to the view calling them, read more on [view lookup](guide.html#view-lookup).
|
||||
|
||||
### Mime Types
|
||||
|
||||
@@ -174,4 +174,4 @@ or perhaps if you preferred not to use the inferred name _user_ you may used a l
|
||||
Previously when using options the `root` option would be used for this:
|
||||
|
||||
app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear }));
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Express - node web framework</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<style>
|
||||
#tagline {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var express = require('../../lib/express');
|
||||
|
||||
var app = express.createServer();
|
||||
|
||||
var users = [
|
||||
{ name: 'tobi' }
|
||||
, { name: 'loki' }
|
||||
, { name: 'jane' }
|
||||
];
|
||||
|
||||
function provides(type) {
|
||||
return function(req, res, next){
|
||||
if (req.accepts(type)) return next();
|
||||
next('route');
|
||||
}
|
||||
}
|
||||
|
||||
// curl http://localhost:3000/users -H "Accept: application/json"
|
||||
|
||||
app.get('/users', provides('json'), function(req, res){
|
||||
res.send(users);
|
||||
});
|
||||
|
||||
// curl http://localhost:3000/users -H "Accept: text/html"
|
||||
|
||||
app.get('/users', provides('html'), function(req, res){
|
||||
res.send('<ul>' + users.map(function(user){
|
||||
return '<li>' + user.name + '</li>';
|
||||
}).join('\n') + '</ul>');
|
||||
});
|
||||
|
||||
// curl http://localhost:3000/users -H "Accept: text/plain"
|
||||
|
||||
app.get('/users', function(req, res, next){
|
||||
res.contentType('txt');
|
||||
res.send(users.map(function(user){
|
||||
return user.name;
|
||||
}).join(', '));
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
console.log('Express server listening on port 3000');
|
||||
+1
-1
@@ -28,7 +28,7 @@ var exports = module.exports = connect.middleware;
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
exports.version = '2.3.11';
|
||||
exports.version = '2.3.12';
|
||||
|
||||
/**
|
||||
* Shortcut for `new Server(...)`.
|
||||
|
||||
+24
-4
@@ -65,6 +65,28 @@ req.header = function(name, defaultValue){
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 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`.
|
||||
*
|
||||
@@ -106,16 +128,14 @@ req.accepts = function(type){
|
||||
return true;
|
||||
} else if (type) {
|
||||
// allow "html" vs "text/html" etc
|
||||
if (type.indexOf('/') < 0) {
|
||||
type = mime.lookup(type);
|
||||
}
|
||||
if (!~type.indexOf('/')) type = mime.lookup(type);
|
||||
|
||||
// check if we have a direct match
|
||||
if (~accept.indexOf(type)) return true;
|
||||
|
||||
// check if we have type/*
|
||||
type = type.split('/')[0] + '/*';
|
||||
return accept.indexOf(type) >= 0;
|
||||
return !!~accept.indexOf(type);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-5
@@ -106,7 +106,7 @@ res.send = function(body, headers, status){
|
||||
}
|
||||
|
||||
// strip irrelevant headers
|
||||
if (204 == status) {
|
||||
if (204 == status || 304 == status) {
|
||||
this.removeHeader('Content-Type');
|
||||
this.removeHeader('Content-Length');
|
||||
}
|
||||
@@ -190,7 +190,7 @@ res.attachment = function(filename){
|
||||
* Transfer the file at the given `path`, with optional
|
||||
* `filename` as an attachment and optional callback `fn(err)`,
|
||||
* and optional `fn2(err)` which is invoked when an error has
|
||||
* occurred after headers have been sent.
|
||||
* occurred after header has been sent.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {String|Function} filename or fn
|
||||
@@ -360,9 +360,7 @@ res.redirect = function(url, status){
|
||||
// Relative
|
||||
if (!~url.indexOf('://')) {
|
||||
// Respect mount-point
|
||||
if (app.route) {
|
||||
url = join(app.route, url);
|
||||
}
|
||||
if (app.route) url = join(app.route, url);
|
||||
|
||||
// Absolute
|
||||
var host = req.headers.host
|
||||
|
||||
+8
-5
@@ -93,20 +93,23 @@ exports.compile = function(view, cache, cid, options){
|
||||
*/
|
||||
|
||||
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) {
|
||||
view = new View(orig.prefixPath, options);
|
||||
if (!view.exists) view = orig;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// Try root ex: <root>/user.jade
|
||||
if (!view.exists) view = new View(orig.rootPath, options);
|
||||
@@ -162,7 +165,7 @@ function renderPartial(res, view, options, parentLocals, parent){
|
||||
if (locals) merge(options, locals);
|
||||
|
||||
// Partials dont need layouts
|
||||
options.renderPartial = true;
|
||||
options.isPartial = true;
|
||||
options.layout = false;
|
||||
|
||||
// Deduce name from view path
|
||||
@@ -360,7 +363,7 @@ res._render = function(view, opts, fn, parent, sub){
|
||||
// capture attempts
|
||||
options.attempts = [];
|
||||
|
||||
var partial = options.renderPartial
|
||||
var partial = options.isPartial
|
||||
, layout = options.layout;
|
||||
|
||||
// Layout support
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "express",
|
||||
"description": "Sinatra inspired web development framework",
|
||||
"version": "2.3.11",
|
||||
"version": "2.3.12",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
|
||||
@@ -10,7 +10,7 @@
|
||||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
|
||||
],
|
||||
"dependencies": {
|
||||
"connect": ">= 1.4.1 < 2.0.0",
|
||||
"connect": ">= 1.5.1 < 2.0.0",
|
||||
"mime": ">= 0.0.1",
|
||||
"qs": ">= 0.0.6"
|
||||
},
|
||||
|
||||
@@ -303,5 +303,36 @@ module.exports = {
|
||||
assert.response(app,
|
||||
{ url: '/incorrect', headers: { Referer: 'expressjs.com' }},
|
||||
{ body: 'expressjs.com' });
|
||||
},
|
||||
|
||||
'test #get(field, param)': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
app.get('/', function(req, res, next){
|
||||
req.get('content-disposition', 'filename')
|
||||
.should.equal('foo bar.jpg');
|
||||
|
||||
req.get('Content-Disposition', 'filename')
|
||||
.should.equal('foo bar.jpg');
|
||||
|
||||
req.get('x-content-foo', 'foo').should.equal('bar');
|
||||
req.get('x-content-foo', 'bar').should.equal('foo bar baz');
|
||||
req.get('x-content-foo', 'woot').should.equal('tobi loki jane');
|
||||
req.get('cache-control', 'max-age').should.equal('500');
|
||||
|
||||
req.get('foo').should.equal('');
|
||||
req.get('foo', 'bar').should.equal('');
|
||||
res.end();
|
||||
});
|
||||
|
||||
var fields = {
|
||||
'Content-Disposition': 'attachment; filename="foo bar.jpg"'
|
||||
, 'X-Content-Foo': 'foo=bar; bar=foo bar baz; woot=tobi loki jane;'
|
||||
, 'Cache-Control': 'max-age = 500'
|
||||
};
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/', headers: fields },
|
||||
{ body: '' });
|
||||
}
|
||||
};
|
||||
Referência em uma Nova Issue
Bloquear um usuário