consul-rust
consul-rust copied to clipboard
KV Values should be base64 decoded
Currently, KV Values are returned as base64 encoded Strings containing arbitrary data. These could be decoded transparently by the library.
Thank you for this. I'll fix this.
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
Added this in https://github.com/stusmall/consul-rust/pull/42
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.