undeadlabs/consul-ex — pull request #3 by wishdev (2014-12-06 22:43:07+00:00)
Title: Switch to exjsx

I was getting the following error from consul-ex using it with discovery (both head from github).

Last message: :timeout
State: %{em: #PID<0.362.0>, index: nil, service: "downloader", services: [], task: nil}
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in JSEX.Decoder.format_key/2
(jsex) lib/jsex.ex:101: JSEX.Decoder.format_key("Node", {:config, :binary, false})
(jsex) lib/jsex.ex:97: JSEX.Decoder.handle_event/2
(jsx) src/jsx_decoder.erl:163: :jsx_decoder.string/5
(jsex) lib/jsex.ex:17: JSEX.decode!/2
(jsex) lib/jsex.ex:24: JSEX.decode/2
(consul) lib/consul/request.ex:22: Consul.Request.process_response_body/1
(consul) lib/consul/request.ex:8: Consul.Request.response/3
(consul) lib/consul/health.ex:8: Consul.Health.req_get/3

The JSON from Consul appears correct (it parses properly) so I looked to upgrade jsex but it appears to have morphed into exjsx. So this patch switches consul-ex over to exjsx. This removed the error for me immediately and I've had no issues using discovery with this in place.