diff --git a/sanitiser/_geo.js b/sanitiser/_geo.js index 28b92812..b6b68f31 100644 --- a/sanitiser/_geo.js +++ b/sanitiser/_geo.js @@ -76,9 +76,6 @@ function sanitize_bbox( clean, param ) { function sanitize_coord( coord, clean, param, latlon_is_required ) { var value = parseFloat( param ); if ( !isNaN( value ) ) { - if( coord === 'lat' && check_lat.is_invalid( value ) ){ - throw new Error( 'invalid ' + check_lat.error_msg ); - } clean[coord] = value; } else if (latlon_is_required) { @@ -92,10 +89,3 @@ function sanitize_zoom_level( clean, param ) { clean.zoom = Math.min( Math.max( zoom, 1 ), 18 ); // max } } - -var check_lat = { - is_invalid: function is_invalid_lat( lat ){ - return isNaN( lat ) || lat < -90 || lat > 90; - }, - error_msg: 'param \'lat\': must be >-90 and <90' -}; diff --git a/test/unit/sanitiser/reverse.js b/test/unit/sanitiser/reverse.js index b85e4f40..d2ff8293 100644 --- a/test/unit/sanitiser/reverse.js +++ b/test/unit/sanitiser/reverse.js @@ -32,8 +32,8 @@ module.exports.tests.interface = function(test, common) { module.exports.tests.sanitize_lat = function(test, common) { var lats = { - invalid: [ -181, -120, -91, 91, 120, 181 ], - valid: [ 0, 45, 90, -0, '0', '45', '90' ], + invalid: [], + valid: [ 0, 45, 90, -0, '0', '45', '90', -181, -120, -91, 91, 120, 181 ], missing: ['', undefined, null] }; test('invalid lat', function(t) { diff --git a/test/unit/sanitiser/search.js b/test/unit/sanitiser/search.js index a2bd4d64..702bbcb5 100644 --- a/test/unit/sanitiser/search.js +++ b/test/unit/sanitiser/search.js @@ -84,8 +84,8 @@ module.exports.tests.sanitize_input_with_delim = function(test, common) { module.exports.tests.sanitize_lat = function(test, common) { var lats = { - invalid: [ -181, -120, -91, 91, 120, 181 ], - valid: [ 0, 45, 90, -0, '0', '45', '90' ] + invalid: [], + valid: [ 0, 45, 90, -0, '0', '45', '90', -181, -120, -91, 91, 120, 181 ] }; test('invalid lat', function(t) { lats.invalid.forEach( function( lat ){ diff --git a/test/unit/sanitiser/suggest.js b/test/unit/sanitiser/suggest.js index a0ec198a..b1ad1be6 100644 --- a/test/unit/sanitiser/suggest.js +++ b/test/unit/sanitiser/suggest.js @@ -82,8 +82,8 @@ module.exports.tests.sanitize_input_with_delim = function(test, common) { module.exports.tests.sanitize_lat = function(test, common) { var lats = { - invalid: [ -181, -120, -91, 91, 120, 181 ], - valid: [ 0, 45, 90, -0, '0', '45', '90' ] + invalid: [], + valid: [ 0, 45, 90, -0, '0', '45', '90', -181, -120, -91, 91, 120, 181 ] }; test('invalid lat', function(t) { lats.invalid.forEach( function( lat ){