Ecwid / consul-api

Java client for Consul HTTP API
Apache License 2.0
417 stars 175 forks source link

Add getKVValueString() convenience methods to KeyValueClient that do base64 decoding #60

Closed csabakos-zz closed 8 years ago

csabakos-zz commented 8 years ago

When accessing strings stored in Consul Key-Value store, the value is always returned in base64 encoding.

KeyValueClient provides the getKVValue() and getKVBinaryValue() family of functions for retrieving values, but in both cases a manual conversion step is needed to reconstruct the original string: base64 decoding is needed after getKVValue(), and byte[] to String conversion is needed after getKVBinaryValue().

It would be nice to introduce a getKVValueString() family of convenience functions that does this manual conversion step automatically.

csabakos-zz commented 8 years ago

Decided to introduce a getDecodedValue() function to GetValue. It results in less code duplication than the original proposal above and is just as convenient. @vgv please kindly review #62