fix(webhook-action): fix webhook action path type error

This commit is contained in:
Turtle 2021-08-12 15:03:56 +08:00 committed by turtleDeng
parent e5c4277109
commit e0336e60da
1 changed files with 7 additions and 4 deletions

View File

@ -314,14 +314,15 @@ ensure_content_type_header(Headers, _Method) ->
lists:keydelete("content-type", 1, Headers).
merge_path(CommonPath, <<>>) ->
CommonPath;
l2b(CommonPath);
merge_path(CommonPath, Path0) ->
case emqx_http_lib:uri_parse(Path0) of
{ok, #{path := Path1, 'query' := Query}} ->
Path2 = filename:join(CommonPath, Path1),
{ok, #{path := Path1, 'query' := Query0}} ->
Path2 = l2b(filename:join(CommonPath, Path1)),
Query = l2b(Query0),
<<Path2/binary, "?", Query/binary>>;
{ok, #{path := Path1}} ->
filename:join(CommonPath, Path1)
l2b(filename:join(CommonPath, Path1))
end.
method(GET) when GET == <<"GET">>; GET == <<"get">> -> get;
@ -386,3 +387,5 @@ test_http_connect(Conf) ->
?LOG(error, "check http_connectivity failed: ~p, ~0p", [Conf, {Err, Reason, ST}]),
false
end.
l2b(L) when is_list(L) -> iolist_to_binary(L);
l2b(Any) -> Any.