Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Unable to differentiate non-existent and empty keys in KV store #43

Description

@ecklm

On the consul API if I query an existing endpoint for keys, I receive an empty list, whereas if I query a non-existent key, I receive HTTP 404.

Using the python library, however, I can't differentiate the two cases.

Examples

Existing but empty

$ curl http://.../v1/kv/?keys=True -v
...
> GET /v1/kv/?keys=True HTTP/1.1
...
< HTTP/1.1 200 OK
< Content-Type: application/json
< Vary: Accept-Encoding
< X-Consul-Default-Acl-Policy: allow
< X-Consul-Index: 74726
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< X-Consul-Query-Backend: blocking-query
< Date: Thu, 03 Nov 2022 16:08:47 GMT
< Content-Length: 2
...
[]
>>> c.kv.get('', keys=True)
('74726', None)

Not existing

$ curl http://.../v1/kv/s/?keys=True -v
...
> GET /v1/kv/s/?keys=True HTTP/1.1
...
< HTTP/1.1 404 Not Found
< Vary: Accept-Encoding
< X-Consul-Default-Acl-Policy: allow
< X-Consul-Index: 74726
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< X-Consul-Query-Backend: blocking-query
< Date: Thu, 03 Nov 2022 16:08:41 GMT
< Content-Length: 0
>>> c.kv.get('s/', keys=True)
('74726', None)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions