Merge pull request #6399 from tigercl/fix/webhook-path

fix(webhook): fix the issue that the path field does not support rule engine variables
This commit is contained in:
tigercl 2021-12-08 14:22:51 +08:00 committed by GitHub
commit a92712e429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -311,15 +311,12 @@ ensure_content_type_header(Headers, _Method) ->
merge_path(CommonPath, <<>>) -> merge_path(CommonPath, <<>>) ->
l2b(CommonPath); l2b(CommonPath);
merge_path(CommonPath, Path0) -> merge_path(CommonPath, Path) ->
case emqx_http_lib:uri_parse(Path0) of Path1 = case Path of
{ok, #{path := Path1, 'query' := Query0}} -> <<"/", Path0/binary>> -> Path0;
Path2 = l2b(filename:join(CommonPath, Path1)), _ -> Path
Query = l2b(Query0), end,
<<Path2/binary, "?", Query/binary>>; l2b(filename:join(CommonPath, Path1)).
{ok, #{path := Path1}} ->
l2b(filename:join(CommonPath, Path1))
end.
method(GET) when GET == <<"GET">>; GET == <<"get">> -> get; method(GET) when GET == <<"GET">>; GET == <<"get">> -> get;
method(POST) when POST == <<"POST">>; POST == <<"post">> -> post; method(POST) when POST == <<"POST">>; POST == <<"post">> -> post;