diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl index eddad92a3..421af074e 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl @@ -100,7 +100,6 @@ common_fields() -> maps:to_list( maps:without( [ - base_url, pool_type ], maps:from_list(emqx_connector_http:fields(config)) diff --git a/apps/emqx_authz/src/emqx_authz_api_schema.erl b/apps/emqx_authz/src/emqx_authz_api_schema.erl index 4adada182..c89ac5bee 100644 --- a/apps/emqx_authz/src/emqx_authz_api_schema.erl +++ b/apps/emqx_authz/src/emqx_authz_api_schema.erl @@ -114,7 +114,6 @@ authz_http_common_fields() -> maps:to_list( maps:without( [ - base_url, pool_type ], maps:from_list(emqx_connector_http:fields(config)) diff --git a/apps/emqx_authz/src/emqx_authz_schema.erl b/apps/emqx_authz/src/emqx_authz_schema.erl index a2a7c6b52..26a22f73b 100644 --- a/apps/emqx_authz/src/emqx_authz_schema.erl +++ b/apps/emqx_authz/src/emqx_authz_schema.erl @@ -230,7 +230,6 @@ http_common_fields() -> maps:to_list( maps:without( [ - base_url, pool_type ], maps:from_list(connector_fields(http)) diff --git a/apps/emqx_bridge/src/schema/emqx_bridge_webhook_schema.erl b/apps/emqx_bridge/src/schema/emqx_bridge_webhook_schema.erl index 1540f77bf..8c9f54d97 100644 --- a/apps/emqx_bridge/src/schema/emqx_bridge_webhook_schema.erl +++ b/apps/emqx_bridge/src/schema/emqx_bridge_webhook_schema.erl @@ -68,7 +68,7 @@ basic_config() -> )} ] ++ webhook_creation_opts() ++ proplists:delete( - max_retries, proplists:delete(base_url, emqx_connector_http:fields(config)) + max_retries, emqx_connector_http:fields(config) ). request_config() -> diff --git a/apps/emqx_connector/src/emqx_connector_http.erl b/apps/emqx_connector/src/emqx_connector_http.erl index bb822a60a..7218258e8 100644 --- a/apps/emqx_connector/src/emqx_connector_http.erl +++ b/apps/emqx_connector/src/emqx_connector_http.erl @@ -35,19 +35,14 @@ reply_delegator/2 ]). --type url() :: emqx_http_lib:uri_map(). --reflect_type([url/0]). --typerefl_from_string({url/0, emqx_http_lib, uri_parse}). - -export([ roots/0, fields/1, desc/1, - validations/0, namespace/0 ]). --export([check_ssl_opts/2, validate_method/1, join_paths/2]). +-export([validate_method/1, join_paths/2]). -type connect_timeout() :: emqx_schema:duration() | infinity. -type pool_type() :: random | hash. @@ -69,20 +64,6 @@ roots() -> fields(config) -> [ - {base_url, - sc( - url(), - #{ - required => true, - validator => fun - (#{query := _Query}) -> - {error, "There must be no query in the base_url"}; - (_) -> - ok - end, - desc => ?DESC("base_url") - } - )}, {connect_timeout, sc( emqx_schema:duration_ms(), @@ -171,9 +152,6 @@ desc("request") -> desc(_) -> undefined. -validations() -> - [{check_ssl_opts, fun check_ssl_opts/1}]. - validate_method(M) when M =:= <<"post">>; M =:= <<"put">>; M =:= <<"get">>; M =:= <<"delete">> -> ok; validate_method(M) -> @@ -578,18 +556,6 @@ make_method(M) when M == <<"PUT">>; M == <<"put">> -> put; make_method(M) when M == <<"GET">>; M == <<"get">> -> get; make_method(M) when M == <<"DELETE">>; M == <<"delete">> -> delete. -check_ssl_opts(Conf) -> - check_ssl_opts("base_url", Conf). - -check_ssl_opts(URLFrom, Conf) -> - #{scheme := Scheme} = hocon_maps:get(URLFrom, Conf), - SSL = hocon_maps:get("ssl", Conf), - case {Scheme, maps:get(enable, SSL, false)} of - {http, false} -> true; - {https, true} -> true; - {_, _} -> false - end. - formalize_request(Method, BasePath, {Path, Headers, _Body}) when Method =:= get; Method =:= delete -> diff --git a/apps/emqx_dashboard/test/emqx_swagger_response_SUITE.erl b/apps/emqx_dashboard/test/emqx_swagger_response_SUITE.erl index a3d2b4e75..f23752653 100644 --- a/apps/emqx_dashboard/test/emqx_swagger_response_SUITE.erl +++ b/apps/emqx_dashboard/test/emqx_swagger_response_SUITE.erl @@ -29,6 +29,10 @@ -compile(nowarn_export_all). -compile(export_all). +-type url() :: emqx_http_lib:uri_map(). +-reflect_type([url/0]). +-typerefl_from_string({url/0, emqx_http_lib, uri_parse}). + all() -> emqx_common_test_helpers:all(?MODULE). init_per_suite(Config) -> @@ -314,7 +318,7 @@ t_sub_fields(_Config) -> ok. t_complicated_type(_Config) -> - Path = "/ref/complicated_type", + Path = "/ref/complex_type", Object = #{ <<"content">> => #{ <<"application/json">> => @@ -633,14 +637,14 @@ schema("/error") -> } } }; -schema("/ref/complicated_type") -> +schema("/ref/complex_type") -> #{ operationId => test, post => #{ responses => #{ 200 => [ {no_neg_integer, hoconsc:mk(non_neg_integer(), #{})}, - {url, hoconsc:mk(emqx_connector_http:url(), #{})}, + {url, hoconsc:mk(url(), #{})}, {server, hoconsc:mk(emqx_schema:ip_port(), #{})}, {connect_timeout, hoconsc:mk(emqx_connector_http:connect_timeout(), #{})}, {pool_type, hoconsc:mk(emqx_connector_http:pool_type(), #{})}, diff --git a/rel/i18n/emqx_connector_http.hocon b/rel/i18n/emqx_connector_http.hocon index 70c644e33..b511d007a 100644 --- a/rel/i18n/emqx_connector_http.hocon +++ b/rel/i18n/emqx_connector_http.hocon @@ -1,14 +1,5 @@ emqx_connector_http { -base_url.desc: -"""The base URL is the URL includes only the scheme, host and port.
-When send an HTTP request, the real URL to be used is the concatenation of the base URL and the -path parameter
-For example: `http://localhost:9901/`""" - -base_url.label: -"""Base Url""" - body.desc: """HTTP request body.""" diff --git a/rel/i18n/zh/emqx_connector_http.hocon b/rel/i18n/zh/emqx_connector_http.hocon index 5d6398b2e..af7869e12 100644 --- a/rel/i18n/zh/emqx_connector_http.hocon +++ b/rel/i18n/zh/emqx_connector_http.hocon @@ -1,13 +1,5 @@ emqx_connector_http { -base_url.desc: -"""base URL 只包含host和port。
-发送HTTP请求时,真实的URL是由base URL 和 path parameter连接而成。
-示例:`http://localhost:9901/`""" - -base_url.label: -"""Base Url""" - body.desc: """HTTP请求报文主体。"""