Set the status code to 400 when invalid query params are sent

This commit is contained in:
Dan Morphis authored and Zaid Abdulla committed 2015-05-31 13:38:47 +03:00
1 parent 7f64b567db
commit 82f354bf2b
1 file changed
+4 -2
+4 -2
View File
@@ -341,8 +341,10 @@ listener = (request, response) ->
if urlParts.query.query? if urlParts.query.query?
try try
q = JSON.parse(urlParts.query.query) q = JSON.parse(urlParts.query.query)
catch e catch err
q = {} response.writeHead(400)
response.end(err.toString())
return
else else
q = {} q = {}
q = query.expand(q, aliases) if collectionName is 'devices' q = query.expand(q, aliases) if collectionName is 'devices'