From 15bd2e4ab4f1bd7948997cd1545b8ae88292c4f9 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Jan 2015 13:26:41 -0800 Subject: [PATCH] fix crash when decoding kv responses when response value is not binary --- lib/consul/handler/kv.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/consul/handler/kv.ex b/lib/consul/handler/kv.ex index f5e4310..cf775cf 100644 --- a/lib/consul/handler/kv.ex +++ b/lib/consul/handler/kv.ex @@ -19,7 +19,7 @@ defmodule Consul.Handler.Kv do defp decode_body(items) when is_list(items) do Enum.map(items, &decode_body/1) end - defp decode_body(%{"Value" => value} = item) do + defp decode_body(%{"Value" => value} = item) when is_binary(value) do %{item | "Value" => :base64.decode(value)} end defp decode_body(item), do: item