httpc:request expects strings, not binaries (#286)

This commit is contained in:
Badlop 2020-03-03 18:23:38 +01:00
parent 5fdcb0a6e3
commit 68c8116102
1 changed files with 6 additions and 9 deletions

View File

@ -42,15 +42,12 @@ stop(Host) ->
depends(_Host, _Opts) -> depends(_Host, _Opts) ->
[]. [].
mod_opt_type(url) -> mod_opt_type(url) -> fun binary_to_list/1;
fun(Val) when is_binary(Val) -> binary_to_list(Val); mod_opt_type(ts_header) -> fun binary_to_list/1;
(Val) -> Val mod_opt_type(from_header) -> fun binary_to_list/1;
end; mod_opt_type(to_header) -> fun binary_to_list/1;
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(headers) -> fun(L) when is_list(L) -> L end; 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(http_options) -> fun(L) when is_list(L) -> L end;
mod_opt_type(req_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; 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) post_xml(From, To, XML)
end. end.