Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Fails to retrieve keyValue in folder by key #443

Open
dschulten opened this issue May 21, 2021 · 1 comment
Open

Fails to retrieve keyValue in folder by key #443

dschulten opened this issue May 21, 2021 · 1 comment

Comments

@dschulten
Copy link

dschulten commented May 21, 2021

Consul allows to organize keyValues in folders, which then become part of the URL path.

In the example kv url below, resources/ is a kv folder and my.key is an actual keyValue pair.

http://consul.example.com/v1/kv/resources/my.key

Unfortunately KeyValueClient.getValue() urlencodes a key with folder prefix such as resources/my.key and requests

/v1/kv/resources%2fmy.key

which fails with 404.

The same problem occurs with KeyValueClient.getValues() for a path of folders, as in getValues("resources/subfolder").

@dschulten
Copy link
Author

dschulten commented May 23, 2021

The reason that the keys are encoded are the @Path annotations on the methods in KeyValueClient.Api. Their encoded property is false, which causes RequestFactory to create a ParameterHandler.Path that encodes the entire key. Probably the Api Methods need a variant with a {path} and a {key} argument where the path is encoded, but not the key - the question is if that could work alongside the existing Api.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant