Send 406 on no search query

This commit is contained in:
Christine Dodrill 2015-08-13 20:56:02 -07:00
parent 651e0f6065
commit e62d6877ad
1 changed files with 3 additions and 0 deletions

View File

@ -130,6 +130,9 @@ routes:
query = @"q".toLower query = @"q".toLower
eps: seq[Episode] eps: seq[Episode]
if query == "":
halt Http406, myHeaders, $ %* { "error": "Need to specify query" }
for episode in episodes: for episode in episodes:
if episode.name.toLower.contains query: if episode.name.toLower.contains query:
eps = eps & episode eps = eps & episode