Merge pull request #928 from CartoDB/extract-cors-mw

Make cors middleware more generic and link it just to application level
This commit is contained in:
Daniel G. Aubert
2018-04-10 18:29:59 +02:00
committed by GitHub
3 changed files with 12 additions and 10 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
const windshaft = require('windshaft');
const MapConfig = windshaft.model.MapConfig;
const Datasource = windshaft.model.Datasource;
const cors = require('../../middleware/cors');
const cleanUpQueryParams = require('../../middleware/clean-up-query-params');
const credentials = require('../../middleware/credentials');
const dbConnSetup = require('../../middleware/db-conn-setup');
@@ -66,9 +65,9 @@ function AnonymousMapController (
module.exports = AnonymousMapController;
AnonymousMapController.prototype.register = function (mapRouter) {
mapRouter.options('/');
mapRouter.get('/', this.composeCreateMapMiddleware());
mapRouter.post('/', this.composeCreateMapMiddleware());
mapRouter.options('/', cors('Content-Type'));
};
AnonymousMapController.prototype.composeCreateMapMiddleware = function () {