consul: Return 404 if no entries found

This commit is contained in:
Armon Dadgar 2014-03-31 20:00:17 -07:00
parent 94df059026
commit ceb6964547
1 changed files with 6 additions and 0 deletions

View File

@ -51,6 +51,12 @@ func (s *HTTPServer) KVSGet(resp http.ResponseWriter, req *http.Request, args *s
return nil, err
}
setIndex(resp, out.Index)
// Check if we get a not found
if len(out.Entries) == 0 {
resp.WriteHeader(404)
return nil, nil
}
return out.Entries, nil
}