Remove locals middleware
This commit is contained in:
parent
5fc801f8a6
commit
5bc5c0ae86
@ -1,7 +0,0 @@
|
|||||||
module.exports = function locals () {
|
|
||||||
return function localsMiddleware (req, res, next) {
|
|
||||||
res.locals = Object.assign({}, req.query, req.params);
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
};
|
|
@ -11,7 +11,6 @@ const cleanUpQueryParamsMiddleware = require('../../../lib/cartodb/middleware/cl
|
|||||||
const authorizeMiddleware = require('../../../lib/cartodb/middleware/authorize');
|
const authorizeMiddleware = require('../../../lib/cartodb/middleware/authorize');
|
||||||
const dbConnSetupMiddleware = require('../../../lib/cartodb/middleware/db-conn-setup');
|
const dbConnSetupMiddleware = require('../../../lib/cartodb/middleware/db-conn-setup');
|
||||||
const credentialsMiddleware = require('../../../lib/cartodb/middleware/credentials');
|
const credentialsMiddleware = require('../../../lib/cartodb/middleware/credentials');
|
||||||
const localsMiddleware = require('../../../lib/cartodb/middleware/locals');
|
|
||||||
|
|
||||||
var windshaft = require('windshaft');
|
var windshaft = require('windshaft');
|
||||||
|
|
||||||
@ -66,18 +65,6 @@ describe('prepare-context', function() {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
it('res.locals are created', function(done) {
|
|
||||||
const locals = localsMiddleware();
|
|
||||||
let req = {};
|
|
||||||
let res = {};
|
|
||||||
|
|
||||||
locals(prepareRequest(req), prepareResponse(res), function(err) {
|
|
||||||
if ( err ) { done(err); return; }
|
|
||||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('cleans up request', function(done){
|
it('cleans up request', function(done){
|
||||||
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
||||||
var res = {};
|
var res = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user