summaryrefslogtreecommitdiff
path: root/src/plop.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plop.erl')
-rw-r--r--src/plop.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plop.erl b/src/plop.erl
index cfca343..6ff65f8 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -200,9 +200,13 @@ add_auth(Method, Path, Headers, Data) ->
[{"X-Catlfish-Auth", AuthHeader} | Headers].
get_auth_header(Headers) ->
- Result = binary_to_list(hackney_headers:get_value("X-Catlfish-Auth", Headers)),
- lager:debug("received auth header: ~p", [Result]),
- Result.
+ case hackney_headers:get_value("X-Catlfish-Auth", Headers) of
+ undefined ->
+ undefined;
+ Result when is_binary(Result) ->
+ lager:debug("received auth header: ~p", [Result]),
+ binary_to_list(Result)
+ end.
send_http_request(TreeLeafHash, URL, Headers, RequestBody) ->
ParentPid = self(),
@@ -243,7 +247,8 @@ send_http_request(TreeLeafHash, URL, Headers, RequestBody) ->
{StatusLine, RespHeaders, Body}}};
noauth ->
lager:debug("no auth"),
- drop
+ ParentPid ! {http, {RequestId,
+ {StatusLine, RespHeaders, Body}}}
end
end),
RequestId.