fix(emqx_gateway): return 204 for lwm2m client posts
Change the return for lwm2m client API posts from 200 to 204 since they contain no content.
This commit is contained in:
parent
faafeba2cd
commit
a8c9d02871
|
@ -81,7 +81,7 @@ schema(?PATH("/observe")) ->
|
||||||
],
|
],
|
||||||
'requestBody' => [],
|
'requestBody' => [],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => <<"No Content">>,
|
204 => <<"No Content">>,
|
||||||
404 => error_codes(['CLIENT_NOT_FOUND'], <<"Clientid not found">>)
|
404 => error_codes(['CLIENT_NOT_FOUND'], <<"Clientid not found">>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ schema(?PATH("/read")) ->
|
||||||
{path, mk(binary(), #{in => query, required => true, example => "/3/0/7"})}
|
{path, mk(binary(), #{in => query, required => true, example => "/3/0/7"})}
|
||||||
],
|
],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => <<"No Content">>,
|
204 => <<"No Content">>,
|
||||||
404 => error_codes(['CLIENT_NOT_FOUND'], <<"clientid not found">>)
|
404 => error_codes(['CLIENT_NOT_FOUND'], <<"clientid not found">>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ schema(?PATH("/write")) ->
|
||||||
{value, mk(binary(), #{in => query, required => true, example => 123})}
|
{value, mk(binary(), #{in => query, required => true, example => 123})}
|
||||||
],
|
],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => <<"No Content">>,
|
204 => <<"No Content">>,
|
||||||
404 => error_codes(['CLIENT_NOT_FOUND'], <<"Clientid not found">>)
|
404 => error_codes(['CLIENT_NOT_FOUND'], <<"Clientid not found">>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ send_cmd(ClientId, Cmd) ->
|
||||||
case emqx_gateway_cm_registry:lookup_channels(lwm2m, ClientId) of
|
case emqx_gateway_cm_registry:lookup_channels(lwm2m, ClientId) of
|
||||||
[Channel | _] ->
|
[Channel | _] ->
|
||||||
ok = emqx_lwm2m_channel:send_cmd(Channel, Cmd),
|
ok = emqx_lwm2m_channel:send_cmd(Channel, Cmd),
|
||||||
{200};
|
{204};
|
||||||
_ ->
|
_ ->
|
||||||
{404, #{code => 'CLIENT_NOT_FOUND'}}
|
{404, #{code => 'CLIENT_NOT_FOUND'}}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue