From 68c81161025db25aa655b664583eb7dacf0034ea Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 3 Mar 2020 18:23:38 +0100 Subject: [PATCH] httpc:request expects strings, not binaries (#286) --- mod_post_log/src/mod_post_log.erl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mod_post_log/src/mod_post_log.erl b/mod_post_log/src/mod_post_log.erl index eab65df..66af7a8 100644 --- a/mod_post_log/src/mod_post_log.erl +++ b/mod_post_log/src/mod_post_log.erl @@ -42,15 +42,12 @@ stop(Host) -> depends(_Host, _Opts) -> []. -mod_opt_type(url) -> - fun(Val) when is_binary(Val) -> binary_to_list(Val); - (Val) -> Val - end; -mod_opt_type(ts_header) -> fun iolist_to_binary/1; -mod_opt_type(from_header) -> fun iolist_to_binary/1; -mod_opt_type(to_header) -> fun iolist_to_binary/1; +mod_opt_type(url) -> fun binary_to_list/1; +mod_opt_type(ts_header) -> fun binary_to_list/1; +mod_opt_type(from_header) -> fun binary_to_list/1; +mod_opt_type(to_header) -> fun binary_to_list/1; mod_opt_type(headers) -> fun(L) when is_list(L) -> L end; -mod_opt_type(content_type) -> fun iolist_to_binary/1; +mod_opt_type(content_type) -> fun binary_to_list/1; mod_opt_type(http_options) -> fun(L) when is_list(L) -> L end; mod_opt_type(req_options) -> fun(L) when is_list(L) -> L end. @@ -81,7 +78,7 @@ log_message(#message{from = From, to = To, body = Body} = Msg) -> <<"">> -> ok; _ -> - XML = fxml:element_to_binary(xmpp:encode(Msg)), + XML = binary_to_list(fxml:element_to_binary(xmpp:encode(Msg))), post_xml(From, To, XML) end.