Skip to content

Commit

Permalink
Merge 819cf69 into 12c23ef
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAX committed Oct 26, 2016
2 parents 12c23ef + 819cf69 commit 761370e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/transports/hello_http_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,16 @@ http_send(Client, Request, Signarute, State = #http_state{url = URL, options = O
{<<"User-Agent">>, <<"hello/", (list_to_binary(Vsn))/binary>>}],
case hackney:Method(URL, Headers, Request, Opts) of
{ok, Success, RespHeaders, ClientRef} when Success =:= 200; Success =:= 201; Success =:= 202 ->
{ok, Body} = hackney:body(ClientRef),
Signature1 = hackney_headers:get_value(<<"content-type">>, hackney_headers:new(RespHeaders), <<"undefined">>),
outgoing_message(Client, Signature1, Body, State);
case hackney:body(ClientRef) of
{ok, Body} ->
Signature1 = hackney_headers:get_value(<<"content-type">>, hackney_headers:new(RespHeaders), <<"undefined">>),
outgoing_message(Client, Signature1, Body, State);
{error, Error} ->
?LOG_ERROR("Http client received an error after executing a request to ~p with reason ~p.", [URL, Error],
lists:append(gen_meta_fields(State), [{hello_error_reason, {{request, Request}, {error, Error}}}]), ?LOGID42),
Client ! {?INCOMING_MSG, {error, Error, State}},
exit(normal)
end;
{ok, HttpCode, _, _} ->
Client ! {?INCOMING_MSG, {error, HttpCode, State}},
exit(normal);
Expand Down

0 comments on commit 761370e

Please sign in to comment.