Merge pull request #9703 from emqx/subscribe-api-function-clause

fix: missing default value for qos field of API /clients/:clientid/subscribe
This commit is contained in:
Xinyu Liu 2023-01-10 10:13:58 +08:00 committed by GitHub
commit 52343e58c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -549,8 +549,8 @@ fields(keepalive) ->
];
fields(subscribe) ->
[
{topic, hoconsc:mk(binary(), #{desc => <<"Topic">>})},
{qos, hoconsc:mk(emqx_schema:qos(), #{desc => <<"QoS">>})},
{topic, hoconsc:mk(binary(), #{required => true, desc => <<"Topic">>})},
{qos, hoconsc:mk(emqx_schema:qos(), #{default => 0, desc => <<"QoS">>})},
{nl, hoconsc:mk(integer(), #{default => 0, desc => <<"No Local">>})},
{rap, hoconsc:mk(integer(), #{default => 0, desc => <<"Retain as Published">>})},
{rh, hoconsc:mk(integer(), #{default => 0, desc => <<"Retain Handling">>})}

View File

@ -0,0 +1,3 @@
Set the default value of the `qos` field of the HTTP API `/clients/:clientid/subscribe` to 0.
Before this fix, the `qos` field have no default value, which leads to a `function_clause` error
when querying this API.

View File

@ -0,0 +1,2 @@
将 HTTP 接口 `/clients/:clientid/subscribe``qos` 字段的默认值设置为 0。
在此修复之前,`qos` 字段没有默认值,调用订阅接口的时候将导致 `function_clause` 错误。