Browse Source

Merge pull request #314 from pelias/remove-redundant-ids-array-check

removed redundant is-ids-an-array check
pull/316/head
Peter Johnson a.k.a. insertcoffee 9 years ago
parent
commit
ef8206be6c
  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