WeAreFarmGeek / diplomat

A HTTP Ruby API for Consul
BSD 3-Clause "New" or "Revised" License
370 stars 116 forks source link

KV.put is now JSON encoding the given data #187

Closed Annih closed 5 years ago

Annih commented 5 years ago

Version

With diplomat (2.1.1)

Step to reproduce

When doing KV.put('my_key', '{ "a": 1}')

Expected result

I expect to save my given value as it in the kv store, i.e.: { "a": 1 }

Actual result

Instead I got "{ \"a\": 1}"

Annih commented 5 years ago

This seems to be related to the following changes https://github.com/WeAreFarmGeek/diplomat/commit/35c369f845ccbaf7aec160b91f3c169c79c8f44e#diff-7730494772290edba80a3e678479ae31L111

Which now leverage send_put_request which does a JSON.dump (https://github.com/WeAreFarmGeek/diplomat/blob/master/lib/diplomat/rest_client.rb#L217)

pierresouchay commented 5 years ago

Thank you for the report, we will revert to old behavior asap