I am confused about the decision to always return a tuple with first element :error from defp handle_response({:ok, %Response{status_code: scode, body: body}}).
This is here:
|
defp handle_response({:ok, %Response{status_code: scode, body: body}}) do |
It seems strange to always return an :error tuple. What is the reasoning behind it?
For the time being, I am using this modified version of the function (which seems simple and more fitting for every use case I have ):
# other http response code
defp handle_response({:ok, %Response{status_code: scode, body: body}}) do
case Jason.decode(body) do
{:ok, json} ->
{:ok, {scode, json}}
# return unprocessed body
_ ->
{:error, {scode, body}}
end
end
I am confused about the decision to always return a tuple with first element
:errorfromdefp handle_response({:ok, %Response{status_code: scode, body: body}}).This is here:
quest/lib/quest/httpoison_dispatcher.ex
Line 43 in 7f6dcaa
It seems strange to always return an :error tuple. What is the reasoning behind it?
For the time being, I am using this modified version of the function (which seems simple and more fitting for every use case I have ):