From 122d1ee6c6b959b12eb1f6c71ee4071ea5e54e23 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 27 Nov 2014 12:01:39 +0100 Subject: [PATCH] convert User/Pwd as string if needed. --- src/hackney_client/hackney_request.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hackney_client/hackney_request.erl b/src/hackney_client/hackney_request.erl index d9e9ea2d..e8b8b982 100644 --- a/src/hackney_client/hackney_request.erl +++ b/src/hackney_client/hackney_request.erl @@ -40,7 +40,9 @@ perform(Client0, {Method0, Path, Headers0, Body0}) -> undefined -> DefaultHeaders0; {User, Pwd} -> - Credentials = base64:encode(<< User/binary, ":", Pwd/binary >>), + User1 = hackney_bstr:to_binary(User), + Pwd1 = hackney_bstr:to_binary(Pwd), + Credentials = base64:encode(<< User1/binary, ":", Pwd1/binary >>), DefaultHeaders0 ++ [{<<"Authorization">>, <<"Basic ", Credentials/binary>>}] end,