mirror of
https://github.com/status-im/consul.git
synced 2025-01-24 20:51:10 +00:00
agent: Key list of root returns empty list with 200 instead of 404
This commit is contained in:
parent
b84b090a5d
commit
2898a8e64e
@ -95,11 +95,17 @@ func (s *HTTPServer) KVSGetKeys(resp http.ResponseWriter, req *http.Request, arg
|
||||
}
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
|
||||
// Check if we get a not found
|
||||
if len(out.Keys) == 0 {
|
||||
// Check if we get a not found. We do not generate
|
||||
// not found for the root, but just provide the empty list
|
||||
if len(out.Keys) == 0 && listArgs.Prefix != "" {
|
||||
resp.WriteHeader(404)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Use empty list instead of null
|
||||
if out.Keys == nil {
|
||||
out.Keys = []string{}
|
||||
}
|
||||
return out.Keys, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user