diff --git a/package.json b/package.json index 46c326df..1429712e 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "geojson": "^0.2.0", "geojson-extent": "^0.3.1", "geopipes-elasticsearch-backend": "0.0.8", + "is-object": "^1.0.1", "pelias-esclient": "0.0.25", "toobusy": "^0.2.4" }, diff --git a/sanitiser/_layers.js b/sanitiser/_layers.js index c12d1711..b1634a46 100644 --- a/sanitiser/_layers.js +++ b/sanitiser/_layers.js @@ -1,4 +1,6 @@ -var indeces = require('../query/indeces'); + +var isObject = require('is-object'), + indeces = require('../query/indeces'); // validate inputs, convert types and apply defaults function sanitize( req ){ @@ -7,7 +9,7 @@ function sanitize( req ){ var params= req.query; // ensure the input params are a valid object - if( Object.prototype.toString.call( params ) !== '[object Object]' ){ + if( !isObject( params ) ){ params = {}; }