Browse Source

removed redundant is-ids-an-array check (already covered by _single_scalar_parameter sanitizer)

pull/314/head
Stephen Hess 9 years ago
parent
commit
00d033101b
  1. 7
      sanitiser/_ids.js
  2. 14
      test/unit/sanitiser/_ids.js

7
sanitiser/_ids.js

@ -57,13 +57,6 @@ function sanitize( raw, clean ){
// error & warning messages
var messages = { errors: [], warnings: [] };
// 'raw.ids' can be an array if ids is specified multiple times
// see https://github.com/pelias/api/issues/272
if (check.array( raw.ids )) {
messages.errors.push( '`ids` parameter specified multiple times.' );
return messages;
}
if (!check.unemptyString( raw.ids )) {
messages.errors.push( lengthError);
return messages;

14
test/unit/sanitiser/_ids.js

@ -126,20 +126,6 @@ module.exports.tests.valid_ids = function(test, common) {
});
};
module.exports.tests.array_of_ids = function(test, common) {
// see https://github.com/pelias/api/issues/272
test('array of ids sent by queryparser', function(t) {
var raw = { ids: ['geoname:2', 'oswmay:4'] };
var clean = {};
var messages = sanitize( raw, clean);
t.deepEqual( messages.errors, ['`ids` parameter specified multiple times.'], 'error sent' );
t.deepEqual( clean.ids, undefined, 'response is empty due to error' );
t.end();
});
};
module.exports.tests.multiple_ids = function(test, common) {
test('multiple ids', function(t) {
var raw = { ids: 'geonames:venue:1,osm:venue:2' };

Loading…
Cancel
Save