removed "root" setting
screw it, no one will understand anyway
Esse commit está contido em:
@@ -79,7 +79,6 @@ app.defaultConfiguration = function(){
|
||||
var self = this;
|
||||
|
||||
// default settings
|
||||
this.set('root', '/');
|
||||
this.set('env', process.env.NODE_ENV || 'development');
|
||||
|
||||
// implicit middleware
|
||||
@@ -191,13 +190,8 @@ app.use = function(route, fn){
|
||||
|
||||
connect.proto.use.call(this, route, fn);
|
||||
|
||||
// mounted an app, emit "mount"
|
||||
// and adjust some settings
|
||||
// mounted an app
|
||||
if (app) {
|
||||
var root = this.get('root') || this.route;
|
||||
if ('/' == root) root = '';
|
||||
root = root + (app.get('root') || app.route);
|
||||
app.set('root', root);
|
||||
app.parent = this;
|
||||
app.emit('mount', this);
|
||||
}
|
||||
|
||||
+4
-6
@@ -362,7 +362,7 @@ res.header = function(field, val){
|
||||
*/
|
||||
|
||||
res.clearCookie = function(name, options){
|
||||
var opts = { expires: new Date(1), path: this.app.get('root') };
|
||||
var opts = { expires: new Date(1), path: '/' };
|
||||
return this.cookie(name, '', options
|
||||
? utils.merge(opts, options)
|
||||
: opts);
|
||||
@@ -392,7 +392,7 @@ res.signedCookie = function(name, val, options){
|
||||
* Options:
|
||||
*
|
||||
* - `maxAge` max-age in milliseconds, converted to `expires`
|
||||
* - `path` defaults to the "root" setting which is typically "/"
|
||||
* - `path` defaults to "/"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
@@ -412,7 +412,7 @@ res.cookie = function(name, val, options){
|
||||
options = options || {};
|
||||
if ('object' == typeof val) val = 'j:' + JSON.stringify(val);
|
||||
if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);
|
||||
if (undefined === options.path) options.path = this.app.set('root');
|
||||
if (undefined === options.path) options.path = '/';
|
||||
var cookie = utils.serializeCookie(name, val, options);
|
||||
this.header('Set-Cookie', cookie);
|
||||
return this;
|
||||
@@ -424,9 +424,7 @@ res.cookie = function(name, val, options){
|
||||
*
|
||||
* The given `url` can also be the name of a mapped url, for
|
||||
* example by default express supports "back" which redirects
|
||||
* to the _Referrer_ or _Referer_ headers or the application's
|
||||
* "root" setting. Express also supports "root" out of the box,
|
||||
* which can be set via `app.set('root', '/blog');`.
|
||||
* to the _Referrer_ or _Referer_ headers or "/".
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
|
||||
@@ -20,7 +20,6 @@ describe('app', function(){
|
||||
var app = express();
|
||||
app.set('title', 'House of Manny');
|
||||
var obj = app.locals.settings;
|
||||
obj.should.have.property('root', '/');
|
||||
obj.should.have.property('env', 'test');
|
||||
obj.should.have.property('title', 'House of Manny');
|
||||
})
|
||||
|
||||
@@ -63,14 +63,5 @@ describe('app', function(){
|
||||
app.use('/blog', blog);
|
||||
blog.parent.should.equal(app);
|
||||
})
|
||||
|
||||
// it('should set "root" to the mount-point', function(){
|
||||
// var blog = express()
|
||||
// , app = express();
|
||||
//
|
||||
// app.use('/blog', blog);
|
||||
// blog.get('root').should.equal('/blog');
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
+17
-17
@@ -20,23 +20,23 @@ describe('res', function(){
|
||||
})
|
||||
})
|
||||
|
||||
it('should default path to "root"', function(done){
|
||||
var app = express();
|
||||
|
||||
app.set('root', '/admin');
|
||||
|
||||
app.use(function(req, res){
|
||||
res.clearCookie('sid').end();
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.end(function(res){
|
||||
var val = 'sid=; path=/admin; expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
res.headers['set-cookie'].should.eql([val]);
|
||||
done();
|
||||
})
|
||||
})
|
||||
// it('should default path to "root"', function(done){
|
||||
// var app = express();
|
||||
//
|
||||
// app.set('root', '/admin');
|
||||
//
|
||||
// app.use(function(req, res){
|
||||
// res.clearCookie('sid').end();
|
||||
// });
|
||||
//
|
||||
// request(app)
|
||||
// .get('/')
|
||||
// .end(function(res){
|
||||
// var val = 'sid=; path=/admin; expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
// res.headers['set-cookie'].should.eql([val]);
|
||||
// done();
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
describe('.clearCookie(name, options)', function(){
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário