Open tomers opened 3 years ago
See https://github.com/pierresouchay/consul-rust/pull/48.
Test code:
let pair = KVPair { Key: String::from("testkey"), Value: String::from("testvalue"), ..Default::default() }; assert!(client.put(&pair, None).unwrap().0); let b64val = client.get("testkey", None).unwrap().0.unwrap().Value; let bytes = base64::decode(b64val).unwrap(); assert_eq!(std::str::from_utf8(&bytes).unwrap().to_string(), "testvalue");
Result:
running 1 test test kv_test ... FAILED failures: ---- kv_test stdout ---- thread 'kv_test' panicked at 'assertion failed: `(left == right)` left: `"\"testvalue\""`, right: `"testvalue"`', tests/kv.rs:23:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: kv_test
I think it caused by write_with_body that stores the value as Json:
write_with_body
let builder = if let Some(b) = body { builder.json(b) } else { builder };
See https://github.com/pierresouchay/consul-rust/pull/48.
Test code:
Result: