Merge pull request #2419 from strongloop/remove-legacyExplorer

[SEMVER-MAJOR] Remove legacyExplorer
This commit is contained in:
Gunjan Pandya 2016-07-14 14:35:38 -04:00 committed by GitHub
commit 7ed003e973
16 changed files with 14 additions and 93 deletions

View File

@ -35,19 +35,6 @@ function rest() {
var app = req.app;
var registry = app.registry;
// added for https://github.com/strongloop/loopback/issues/1134
if (app.get('legacyExplorer') !== false) {
deprecate(
'Routes "/methods" and "/models" are considered dangerous and should not be used.\n' +
'Disable them by setting "legacyExplorer=false" in "server/config.json" or via "app.set()".'
);
if (req.url === '/routes') {
return res.send(app.handler('rest').adapter.allRoutes());
} else if (req.url === '/models') {
return res.send(app.remotes().toJSON());
}
}
if (!handlers) {
handlers = [];
var remotingOptions = app.get('remoting') || {};

View File

@ -1,11 +1,10 @@
{
"port": 3000,
"host": "0.0.0.0",
"legacyExplorer": false,
"remoting": {
"errorHandler": {
"debug": true,
"log": false
}
}
}
}

View File

@ -27,7 +27,5 @@
"*": false,
"destroyAll": true
}
},
"legacyExplorer": false
}
}

View File

@ -26,7 +26,5 @@
"sharedMethods": {
"*": false
}
},
"legacyExplorer": false
}
}

View File

@ -26,7 +26,5 @@
"sharedMethods": {
"*": true
}
},
"legacyExplorer": false
}
}

View File

@ -26,7 +26,5 @@
"sharedMethods": {
"find": false
}
},
"legacyExplorer": false
}
}

View File

@ -26,7 +26,5 @@
"sharedMethods": {
"find": true
}
},
"legacyExplorer": false
}
}

View File

@ -23,7 +23,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}

View File

@ -23,7 +23,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}

View File

@ -23,7 +23,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}

View File

@ -23,7 +23,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}

View File

@ -1,7 +1,6 @@
{
"port": 3000,
"host": "127.0.0.1",
"legacyExplorer": false,
"remoting": {
"errorHandler": {
"debug": true,

View File

@ -14,6 +14,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}
}

View File

@ -14,6 +14,5 @@
"debug": true,
"log": false
}
},
"legacyExplorer": false
}
}
}

View File

@ -502,7 +502,6 @@ describe('Replication over REST', function() {
serverApp.use(loopback.token({ model: ServerToken }));
serverApp.use(loopback.rest());
serverApp.set('legacyExplorer', false);
serverApp.set('port', 0);
serverApp.set('host', '127.0.0.1');
serverApp.listen(function() {

View File

@ -27,7 +27,6 @@ describe('loopback.rest', function() {
});
it('should report 200 for DELETE /:id found', function(done) {
app.set('legacyExplorer', false);
app.model(MyModel);
app.use(loopback.rest());
MyModel.create({ name: 'm1' }, function(err, inst) {
@ -197,48 +196,6 @@ describe('loopback.rest', function() {
}, done);
});
it('should report 200 for legacy explorer route /routes', function(done) {
app.use(loopback.rest());
request(app).get('/routes')
.expect(200)
.end(function(err, res) {
if (err) return done(err);
expect(res.body).to.eql([]);
done();
});
});
it('should report 200 for legacy explorer route /models', function(done) {
app.use(loopback.rest());
request(app).get('/models')
.expect(200)
.end(function(err, res) {
if (err) return done(err);
expect(res.body).to.eql({});
done();
});
});
it('should report 404 for disabled legacy explorer route /routes', function(done) {
app.set('legacyExplorer', false);
app.use(loopback.rest());
request(app).get('/routes')
.expect(404)
.end(done);
});
it('should report 404 for disabled legacy explorer route /models', function(done) {
app.set('legacyExplorer', false);
app.use(loopback.rest());
request(app).get('/models')
.expect(404)
.end(done);
});
describe('context propagation', function() {
var User;