mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 05:13:30 -07:00
Send 204 when WebAPI response contains no data
This commit is contained in:
parent
20482be4a8
commit
72548fd18d
1 changed files with 34 additions and 27 deletions
|
@ -361,6 +361,12 @@ void WebApplication::doProcessRequest()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const APIResult result = controller->run(action, m_params, data);
|
const APIResult result = controller->run(action, m_params, data);
|
||||||
|
if (result.data.isNull())
|
||||||
|
{
|
||||||
|
status(204);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (result.data.userType())
|
switch (result.data.userType())
|
||||||
{
|
{
|
||||||
case QMetaType::QJsonDocument:
|
case QMetaType::QJsonDocument:
|
||||||
|
@ -393,6 +399,7 @@ void WebApplication::doProcessRequest()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (const APIError &error)
|
catch (const APIError &error)
|
||||||
{
|
{
|
||||||
// re-throw as HTTPError
|
// re-throw as HTTPError
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue