1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 23:07:59 +00:00

Reuse code path in switch cases

This commit is contained in:
Chocobo1 2019-11-06 13:59:59 +08:00
parent 9b5df92078
commit 8fe8cbd3d1
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -267,12 +267,10 @@ void WebApplication::doProcessRequest()
try {
const QVariant result = controller->run(action, m_params, data);
switch (result.userType()) {
case QMetaType::QString:
print(result.toString(), Http::CONTENT_TYPE_TXT);
break;
case QMetaType::QJsonDocument:
print(result.toJsonDocument().toJson(QJsonDocument::Compact), Http::CONTENT_TYPE_JSON);
break;
case QMetaType::QString:
default:
print(result.toString(), Http::CONTENT_TYPE_TXT);
break;