From 6eeb75a35ef30ba6265128d13cbac56200c52f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 11 May 2018 16:13:34 +0200 Subject: [PATCH] Use .middlewares() method to build middleware stack to process the request --- lib/cartodb/api/map/analyses-catalog-controller.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/api/map/analyses-catalog-controller.js b/lib/cartodb/api/map/analyses-catalog-controller.js index 760c0e80..870d81dc 100644 --- a/lib/cartodb/api/map/analyses-catalog-controller.js +++ b/lib/cartodb/api/map/analyses-catalog-controller.js @@ -17,8 +17,11 @@ function AnalysesController(pgConnection, authBackend, userLimitsBackend) { module.exports = AnalysesController; AnalysesController.prototype.register = function (mapRouter) { - mapRouter.get( - `/analyses/catalog`, + mapRouter.get('/analyses/catalog', this.middlewares()); +}; + +AnalysesController.prototype.middlewares = function () { + return [ credentials(), authorize(this.authBackend), dbConnSetup(this.pgConnection), @@ -30,7 +33,7 @@ AnalysesController.prototype.register = function (mapRouter) { prepareResponse(), cacheControlHeader({ ttl: 10, revalidate: true }), unauthorizedError() - ); + ]; }; function createPGClient () {