diff --git a/sanitizer/_categories.js b/sanitizer/_categories.js index 7bff93f50..b7fe14180 100644 --- a/sanitizer/_categories.js +++ b/sanitizer/_categories.js @@ -7,7 +7,7 @@ const WARNINGS = { }; // validate inputs, convert types and apply defaults -function _sanitize (raw, clean, validator) { +function _sanitize (raw, clean, req, validator) { validator = validator || allValidValidator; // error & warning messages diff --git a/sanitizer/_geonames_deprecation.js b/sanitizer/_geonames_deprecation.js index 2cdef1d1e..e1e5d59c8 100644 --- a/sanitizer/_geonames_deprecation.js +++ b/sanitizer/_geonames_deprecation.js @@ -9,7 +9,7 @@ const _ = require('lodash'); const coarse_reverse_message ='coarse /reverse does not support geonames. See https://github.com/pelias/pelias/issues/675 for more info'; -function _sanitize( raw, clean, opts ) { +function _sanitize( raw, clean ) { // error & warning messages const messages = { errors: [], warnings: [] }; diff --git a/test/unit/sanitizer/_categories.js b/test/unit/sanitizer/_categories.js index 8593dd8ee..69533e746 100644 --- a/test/unit/sanitizer/_categories.js +++ b/test/unit/sanitizer/_categories.js @@ -89,7 +89,7 @@ module.exports.tests.valid_categories = function(test, common) { clean: { } }; - var messages = sanitizer.sanitize(req.query, req.clean, validCategories); + var messages = sanitizer.sanitize(req.query, req.clean, req, validCategories); t.deepEqual(req.clean.categories, ['food'], 'categories should contain food'); t.deepEqual(messages.errors, [], 'no error returned'); @@ -110,7 +110,7 @@ module.exports.tests.valid_categories = function(test, common) { }; var expectedCategories = ['food', 'health']; - var messages = sanitizer.sanitize(req.query, req.clean, validCategories); + var messages = sanitizer.sanitize(req.query, req.clean, req, validCategories); t.deepEqual(req.clean.categories, expectedCategories, 'clean.categories should be an array with proper values'); @@ -145,7 +145,7 @@ module.exports.tests.invalid_categories = function(test, common) { ] }; - var messages = sanitizer.sanitize(req.query, req.clean, validCategories); + var messages = sanitizer.sanitize(req.query, req.clean, req, validCategories); t.deepEqual(messages, expected_messages, 'error with message returned'); t.deepEqual(req.clean.categories, [], 'empty categories array should be defined'); @@ -166,7 +166,7 @@ module.exports.tests.invalid_categories = function(test, common) { ] }; - var messages = sanitizer.sanitize(req.query, req.clean, validCategories); + var messages = sanitizer.sanitize(req.query, req.clean, req, validCategories); t.deepEqual(messages, expected_messages, 'error with message returned'); t.deepEqual(req.clean.categories, [], 'empty categories array should be defined');