doing changes after merge with middlewarify
This commit is contained in:
parent
5c0f597cbb
commit
e3405ea2fc
@ -3,7 +3,6 @@ const _ = require('underscore');
|
||||
module.exports = function dbConnSetupMiddleware(pgConnection) {
|
||||
return function dbConnSetup(req, res, next) {
|
||||
const user = res.locals.user;
|
||||
|
||||
pgConnection.setDBConn(user, res.locals, (err) => {
|
||||
if (err) {
|
||||
if (err.message && -1 !== err.message.indexOf('name not found')) {
|
||||
@ -21,11 +20,11 @@ module.exports = function dbConnSetupMiddleware(pgConnection) {
|
||||
dbhost: global.environment.postgres.host,
|
||||
dbport: global.environment.postgres.port
|
||||
});
|
||||
|
||||
res.set('X-Served-By-DB-Host', req.params.dbhost);
|
||||
|
||||
res.set('X-Served-By-DB-Host', res.locals.dbhost);
|
||||
|
||||
req.profiler.done('req2params');
|
||||
|
||||
|
||||
next(null);
|
||||
});
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ describe('prepare-context', function() {
|
||||
}
|
||||
};
|
||||
|
||||
res = {};
|
||||
res = { set: function () {} };
|
||||
|
||||
dbConnSetup(prepareRequest(req), prepareResponse(res), function() {
|
||||
// wrong key resets params to no user
|
||||
|
Loading…
Reference in New Issue
Block a user