Merge pull request #12148 from zhongwencool/bridge-http-action-without-path

fix: don't require path in http action(fill default path)
This commit is contained in:
zhongwencool 2023-12-13 09:13:34 +08:00 committed by GitHub
commit a1cd1f7c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -67,7 +67,7 @@ connector_action_config_to_bridge_v1_config(ConnectorConfig, ActionConfig) ->
}. }.
bridge_v1_config_to_connector_config(BridgeV1Conf) -> 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)), ok = validate_webhook_url(maps:get(<<"url">>, BridgeV1Conf, undefined)),
maps:without(?REMOVED_KEYS ++ ?ACTION_KEYS ++ ?PARAMETER_KEYS, BridgeV1Conf). maps:without(?REMOVED_KEYS ++ ?ACTION_KEYS ++ ?PARAMETER_KEYS, BridgeV1Conf).

View File

@ -565,12 +565,8 @@ preprocess_request(undefined) ->
undefined; undefined;
preprocess_request(Req) when map_size(Req) == 0 -> preprocess_request(Req) when map_size(Req) == 0 ->
undefined; undefined;
preprocess_request( preprocess_request(#{method := Method} = Req) ->
#{ Path = maps:get(path, Req, <<>>),
method := Method,
path := Path
} = Req
) ->
Headers = maps:get(headers, Req, []), Headers = maps:get(headers, Req, []),
#{ #{
method => parse_template(to_bin(Method)), method => parse_template(to_bin(Method)),