removed "root" setting
Before adoption: this commit came in with the history the project adopted, so no landing records it.
screw it, no one will understand anyway
authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 5d593f2 · Browse files · 5 files·+22 added−40 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+22 added−40 removed
- tests:+17 added−27 removed
- other:+5 added−13 removed
Provenance
- Commit
87b991c- Tree
ea91d15- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
5d593f2
5 files changed+22 added−40 removed
modified:lib/application.js+1 added-7 removed
77 unmodified lines78 app.defaultConfiguration = function(){79 var self = this;80 81 // default settings82- this.set('root', '/');82 this.set('env', process.env.NODE_ENV || 'development');83 84 // implicit middleware85 this.use(connect.query());103 unmodified lines189 }190 191 connect.proto.use.call(this, route, fn);192 194- // mounted an app, emit "mount"195- // and adjust some settings193+ // mounted an app194 if (app) {197- var root = this.get('root') || this.route;198- if ('/' == root) root = '';199- root = root + (app.get('root') || app.route);200- app.set('root', root);195 app.parent = this;196 app.emit('mount', this);197 }198 358 unmodified linesmodified:lib/response.js+4 added-6 removed
360 unmodified lines361 * @api public362 */363 364 res.clearCookie = function(name, options){365- var opts = { expires: new Date(1), path: this.app.get('root') };365+ var opts = { expires: new Date(1), path: '/' };366 return this.cookie(name, '', options367 ? utils.merge(opts, options)368 : opts);369 };21 unmodified lines391 *392 * Options:393 *394 * - `maxAge` max-age in milliseconds, converted to `expires`395- * - `path` defaults to the "root" setting which is typically "/"395+ * - `path` defaults to "/"396 *397 * Examples:398 *399 * // "Remember Me" for 15 minutes11 unmodified lines411 res.cookie = function(name, val, options){412 options = options || {};413 if ('object' == typeof val) val = 'j:' + JSON.stringify(val);414 if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);415- if (undefined === options.path) options.path = this.app.set('root');415+ if (undefined === options.path) options.path = '/';416 var cookie = utils.serializeCookie(name, val, options);417 this.header('Set-Cookie', cookie);418 return this;419 };3 unmodified lines423 * defaulting to 302.424 *425 * The given `url` can also be the name of a mapped url, for426 * example by default express supports "back" which redirects427- * to the _Referrer_ or _Referer_ headers or the application's428- * "root" setting. Express also supports "root" out of the box,429- * which can be set via `app.set('root', '/blog');`.427+ * to the _Referrer_ or _Referer_ headers or "/".428 *429 * Examples:430 *431 * res.redirect('/foo/bar');165 unmodified linesmodified:test/app.locals.js-1 removed
18 unmodified lines1920212223232425262718 unmodified lines it('should expose app settings', 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'); }) })})modified:test/app.use.js-9 removed
61 unmodified lines62636465666768697071727366677661 unmodified lines
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'); // }) })})
modified:test/res.clearCookie.js+17 added-17 removed
18 unmodified lines19202122232425262728293031323334353637383923242526272829303132333435363738394041424316 unmodified lines18 unmodified lines 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(); }) }) // 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(){ it('should set the given params', function(done){16 unmodified lines