mirror of
https://github.com/zebrajr/express.git
synced 2026-01-15 12:15:27 +00:00
@@ -1,3 +1,8 @@
|
||||
unreleased
|
||||
==========
|
||||
|
||||
* fix `subapp.mountpath` regression for `app.use(subapp)`
|
||||
|
||||
4.6.0 / 2014-07-11
|
||||
==================
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ app.use = function use(path, fn) {
|
||||
// express app
|
||||
if (mount_app && mount_app.handle && mount_app.set) {
|
||||
debug('.use app under %s', mount_path);
|
||||
mount_app.mountpath = path;
|
||||
mount_app.mountpath = mount_path;
|
||||
mount_app.parent = this;
|
||||
|
||||
// restore .app property on req and res
|
||||
|
||||
13
test/app.js
13
test/app.js
@@ -39,16 +39,19 @@ describe('app.parent', function(){
|
||||
|
||||
describe('app.mountpath', function(){
|
||||
it('should return the mounted path', function(){
|
||||
var app = express()
|
||||
, blog = express()
|
||||
, blogAdmin = express();
|
||||
var admin = express();
|
||||
var app = express();
|
||||
var blog = express();
|
||||
var fallback = express();
|
||||
|
||||
app.use('/blog', blog);
|
||||
blog.use('/admin', blogAdmin);
|
||||
app.use(fallback);
|
||||
blog.use('/admin', admin);
|
||||
|
||||
admin.mountpath.should.equal('/admin');
|
||||
app.mountpath.should.equal('/');
|
||||
blog.mountpath.should.equal('/blog');
|
||||
blogAdmin.mountpath.should.equal('/admin');
|
||||
fallback.mountpath.should.equal('/');
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user