diff --git a/apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl b/apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl index d55b92138..1b5e51a11 100644 --- a/apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl +++ b/apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl @@ -1284,19 +1284,17 @@ t_inconsistent_webhook_request_timeouts(Config) -> <<"resource_opts">> => #{<<"request_timeout">> => <<"2s">>} } ), - ?assertMatch( - {ok, 201, #{ - %% note: same value on both fields - <<"request_timeout">> := <<"2s">>, - <<"resource_opts">> := #{<<"request_timeout">> := <<"2s">>} - }}, + {ok, 201, #{ + <<"request_timeout">> := <<"1s">>, + <<"resource_opts">> := ResourceOpts + }} = request_json( post, uri(["bridges"]), BadBridgeParams, Config - ) - ), + ), + ?assertNot(maps:is_key(<<"request_timeout">>, ResourceOpts)), ok. %% diff --git a/apps/emqx_bridge/test/emqx_bridge_compatible_config_tests.erl b/apps/emqx_bridge/test/emqx_bridge_compatible_config_tests.erl index acafb84ca..3481ac30c 100644 --- a/apps/emqx_bridge/test/emqx_bridge_compatible_config_tests.erl +++ b/apps/emqx_bridge/test/emqx_bridge_compatible_config_tests.erl @@ -59,27 +59,21 @@ webhook_config_test() -> }, check(Conf2) ), - - %% the converter should pick the greater of the two - %% request_timeouts and place them in the root and inside - %% resource_opts. - ?assertMatch( - #{ - <<"bridges">> := #{ - <<"webhook">> := #{ - <<"the_name">> := - #{ - <<"method">> := get, - <<"request_timeout">> := 60_000, - <<"resource_opts">> := #{<<"request_timeout">> := 60_000}, - <<"body">> := <<"${payload}">> - } - } + #{ + <<"bridges">> := #{ + <<"webhook">> := #{ + <<"the_name">> := + #{ + <<"method">> := get, + <<"request_timeout">> := RequestTime, + <<"resource_opts">> := ResourceOpts, + <<"body">> := <<"${payload}">> + } } - }, - check(Conf3) - ), - + } + } = check(Conf3), + ?assertEqual(60_000, RequestTime), + ?assertNot(maps:is_key(<<"requst_timeout">>, ResourceOpts)), ok. up(#{<<"bridges">> := Bridges0} = Conf0) -> diff --git a/changes/ce/feat-10713.en.md b/changes/ce/feat-10713.en.md new file mode 100644 index 000000000..0e28a1a12 --- /dev/null +++ b/changes/ce/feat-10713.en.md @@ -0,0 +1,3 @@ +We deprecated the request_timeout in resource_option of the webhook to keep it consistent with the http request_timeout of the webhook. +From now on, when configuring a webhook through API or configuration files, +it is no longer necessary to configure the request_timeout of the resource. Only configuring the http request_timeout is sufficient, and the request_timeout in the resource will automatically be consistent with the http request_timeout.