Correct HTTP codes for query errors

Respond with HTTP 400 for queries with multiple or no results, as
specified in the documentation
Merge pull request #170 from logandk/fix-issue-170

Correct HTTP codes for query errors