chore: use put instead of post to update setting
This commit is contained in:
parent
f40d8318b7
commit
a8b9b6f27f
|
@ -54,6 +54,7 @@ schema("/license") ->
|
|||
)
|
||||
}
|
||||
},
|
||||
%% FIXME: It's a update action, should use put instead of post in 5.2.0
|
||||
post => #{
|
||||
tags => ?LICENSE_TAGS,
|
||||
summary => <<"Update license key">>,
|
||||
|
@ -93,7 +94,7 @@ schema("/license/setting") ->
|
|||
200 => setting()
|
||||
}
|
||||
},
|
||||
post => #{
|
||||
put => #{
|
||||
tags => ?LICENSE_TAGS,
|
||||
summary => <<"Update license setting">>,
|
||||
description => ?DESC("desc_license_setting_api"),
|
||||
|
@ -144,7 +145,7 @@ error_msg(Code, Msg) ->
|
|||
|
||||
'/license/setting'(get, _Params) ->
|
||||
{200, maps:remove(<<"key">>, emqx_config:get_raw([license]))};
|
||||
'/license/setting'(post, #{body := Setting}) ->
|
||||
'/license/setting'(put, #{body := Setting}) ->
|
||||
case emqx_license:update_setting(Setting) of
|
||||
{error, Error} ->
|
||||
?SLOG(error, #{
|
||||
|
|
|
@ -186,7 +186,7 @@ t_license_setting(_Config) ->
|
|||
%% update
|
||||
Low = <<"50%">>,
|
||||
High = <<"55%">>,
|
||||
UpdateRes = request(post, uri(["license", "setting"]), #{
|
||||
UpdateRes = request(put, uri(["license", "setting"]), #{
|
||||
<<"connection_low_watermark">> => Low,
|
||||
<<"connection_high_watermark">> => High
|
||||
}),
|
||||
|
@ -197,14 +197,14 @@ t_license_setting(_Config) ->
|
|||
%% update bad setting low >= high
|
||||
?assertMatch(
|
||||
{ok, 400, _},
|
||||
request(post, uri(["license", "setting"]), #{
|
||||
request(put, uri(["license", "setting"]), #{
|
||||
<<"connection_low_watermark">> => <<"50%">>,
|
||||
<<"connection_high_watermark">> => <<"50%">>
|
||||
})
|
||||
),
|
||||
?assertMatch(
|
||||
{ok, 400, _},
|
||||
request(post, uri(["license", "setting"]), #{
|
||||
request(put, uri(["license", "setting"]), #{
|
||||
<<"connection_low_watermark">> => <<"51%">>,
|
||||
<<"connection_high_watermark">> => <<"50%">>
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue