Skip to content

Commit

Permalink
Print response
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed Dec 12, 2023
1 parent 42fc15d commit 4a7033a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/simplehttp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule SimpleHttp do
def close(%Response{profile: profile}), do: close(profile)

@spec execute(SimpleHttp.Request.t()) :: {:error, any()} | {:ok, SimpleHttp.Response.t()}
defp execute(%Request{} = req) do
defp execute(%Request{args: args} = req) do
params =
(req.body && {req.url, req.headers, req.content_type, req.body}) || {req.url, req.headers}

Expand All @@ -63,6 +63,8 @@ defmodule SimpleHttp do
:httpc.request(req.method, params, req.http_options, req.options, profile)
end

Keyword.get(args, :debug) && IO.puts("Response: #{inspect(httpc_response, pretty: true)}")

case httpc_response do
{:ok, {{_, status, _}, headers, body}} ->
response = %Response{
Expand Down

0 comments on commit 4a7033a

Please sign in to comment.