consul-rust icon indicating copy to clipboard operation
consul-rust copied to clipboard

KV Values should be base64 decoded

Open fussybeaver opened this issue 5 years ago • 4 comments

Currently, KV Values are returned as base64 encoded Strings containing arbitrary data. These could be decoded transparently by the library.

fussybeaver avatar Nov 19 '19 13:11 fussybeaver

Thank you for this. I'll fix this.

stusmall avatar Mar 15 '20 22:03 stusmall

It should be decoded as Option<bytes[]>

Since most utils around Consul are working with UTF-8, we might add helper to decode, as UTF-8 Readers, but in any case, this is Optional byte[] data

pierresouchay avatar Mar 16 '20 22:03 pierresouchay

Added this in https://github.com/stusmall/consul-rust/pull/42

jmcconnell26 avatar May 10 '20 14:05 jmcconnell26

Unfortunately, it cannot be achieved with a current KVPair struct having value: String without breaking changes in API. Non-string content cannot be decoded transparently to String.

Refactoring in PR #20 stores an optional byte array (value: Vec<u8>) in a value with a custom serde, and fixes this problem. But it is a breaking API change too.

theirix avatar Mar 01 '23 19:03 theirix