From cd1365d7537cc4ddb2c120fb1b67fdd96c775bc4 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 12 Dec 2023 10:15:53 +0800 Subject: [PATCH] fix: don't require path in http action(fill default path) --- .../emqx_bridge_http/src/emqx_bridge_http_action_info.erl | 2 +- apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/emqx_bridge_http/src/emqx_bridge_http_action_info.erl b/apps/emqx_bridge_http/src/emqx_bridge_http_action_info.erl index 457d8ff4b..4825cdbb3 100644 --- a/apps/emqx_bridge_http/src/emqx_bridge_http_action_info.erl +++ b/apps/emqx_bridge_http/src/emqx_bridge_http_action_info.erl @@ -67,7 +67,7 @@ connector_action_config_to_bridge_v1_config(ConnectorConfig, ActionConfig) -> }. bridge_v1_config_to_connector_config(BridgeV1Conf) -> - %% To statisfy the emqx_bridge_api_SUITE:t_http_crud_apis/1 + %% To satisfy the emqx_bridge_api_SUITE:t_http_crud_apis/1 ok = validate_webhook_url(maps:get(<<"url">>, BridgeV1Conf, undefined)), maps:without(?REMOVED_KEYS ++ ?ACTION_KEYS ++ ?PARAMETER_KEYS, BridgeV1Conf). diff --git a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl index 5ecfa76d1..1777fbe1f 100644 --- a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl +++ b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl @@ -565,12 +565,8 @@ preprocess_request(undefined) -> undefined; preprocess_request(Req) when map_size(Req) == 0 -> undefined; -preprocess_request( - #{ - method := Method, - path := Path - } = Req -) -> +preprocess_request(#{method := Method} = Req) -> + Path = maps:get(path, Req, <<>>), Headers = maps:get(headers, Req, []), #{ method => parse_template(to_bin(Method)),