Do not pass the whole res.locals to backends

This commit is contained in:
Daniel García Aubert
2018-03-07 12:52:44 +01:00
parent 5871f8290d
commit ec41cddb19
+6 -3
View File
@@ -312,8 +312,9 @@ LayergroupController.prototype.getMapStoreMapConfigProvider = function (mapStore
LayergroupController.prototype.getDataview = function (dataviewBackend) {
return function getDataviewMiddleware (req, res, next) {
const { user, mapConfigProvider } = res.locals;
const params = getRequestParams(res.locals);
dataviewBackend.getDataview(mapConfigProvider, user, res.locals, (err, dataview, stats = {}) => {
dataviewBackend.getDataview(mapConfigProvider, user, params, (err, dataview, stats = {}) => {
req.profiler.add(stats);
if (err) {
@@ -331,8 +332,9 @@ LayergroupController.prototype.getDataview = function (dataviewBackend) {
LayergroupController.prototype.dataviewSearch = function (dataviewBackend) {
return function dataviewSearchMiddlewarify (req, res, next) {
const { user, dataviewName, mapConfigProvider } = res.locals;
const params = getRequestParams(res.locals);
dataviewBackend.search(mapConfigProvider, user, dataviewName, res.locals, (err, searchResult, stats = {}) => {
dataviewBackend.search(mapConfigProvider, user, dataviewName, params, (err, searchResult, stats = {}) => {
req.profiler.add(stats);
if (err) {
@@ -352,8 +354,9 @@ LayergroupController.prototype.attributes = function (attributesBackend) {
req.profiler.start('windshaft.maplayer_attribute');
const { mapConfigProvider } = res.locals;
const params = getRequestParams(res.locals);
attributesBackend.getFeatureAttributes(mapConfigProvider, res.locals, false, (err, tile, stats = {}) => {
attributesBackend.getFeatureAttributes(mapConfigProvider, params, false, (err, tile, stats = {}) => {
req.profiler.add(stats);
if (err) {