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, <<>>) ->
l2b(CommonPath);
merge_path(CommonPath, Path0) ->
case emqx_http_lib:uri_parse(Path0) of
{ok, #{path := Path1, 'query' := Query0}} ->
Path2 = l2b(filename:join(CommonPath, Path1)),
Query = l2b(Query0),
<<Path2/binary, "?", Query/binary>>;
{ok, #{path := Path1}} ->
l2b(filename:join(CommonPath, Path1))
end.
merge_path(CommonPath, Path) ->
Path1 = case Path of
<<"/", Path0/binary>> -> Path0;
_ -> Path
end,
l2b(filename:join(CommonPath, Path1)).
method(GET) when GET == <<"GET">>; GET == <<"get">> -> get;
method(POST) when POST == <<"POST">>; POST == <<"post">> -> post;