Remove locals middleware

This commit is contained in:
Daniel García Aubert 2018-03-23 16:53:00 +01:00
parent 5fc801f8a6
commit 5bc5c0ae86
2 changed files with 0 additions and 20 deletions

View File

@ -1,7 +0,0 @@
module.exports = function locals () {
return function localsMiddleware (req, res, next) {
res.locals = Object.assign({}, req.query, req.params);
next();
};
};

View File

@ -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 = {};