fix: removed query from request body

This commit is contained in:
Mitternacht822
2025-12-08 16:36:59 +04:00
parent f02128796a
commit 1cb171698a
+9 -17
View File
@@ -2,7 +2,6 @@
#include <QVariant> #include <QVariant>
#include <QJsonParseError> #include <QJsonParseError>
#include <QUrlQuery>
#include <QtConcurrent/QtConcurrentRun> #include <QtConcurrent/QtConcurrentRun>
#include <QThread> #include <QThread>
#include <QDebug> #include <QDebug>
@@ -179,17 +178,13 @@ void TransferController::onTransferQrScanned(const QString &code)
m_settings->isStrictKillSwitchEnabled()); m_settings->isStrictKillSwitchEnabled());
QByteArray responseBody; QByteArray responseBody;
QJsonObject payload; QJsonObject payload;
payload.insert("config", config); payload.insert(QStringLiteral("config"), config);
payload.insert(QStringLiteral("uuid"), uuid);
payload.insert(QStringLiteral("api_key"), apiKey);
const QString endpoint = QStringLiteral("%1sendConfig").arg(gw);
// URL-encode query qDebug() << "TransferController::onTransferQrScanned: sending POST to" << endpoint
QUrlQuery q; << "with payload:" << QJsonDocument(payload).toJson(QJsonDocument::Compact);
q.addQueryItem(QStringLiteral("uuid"), uuid);
q.addQueryItem(QStringLiteral("api_key"), apiKey);
const QString endpoint = QStringLiteral("%1sendConfig?%2")
.arg(gw)
.arg(q.query(QUrl::FullyEncoded));
qDebug() << "TransferController::onTransferQrScanned: sending POST to" << endpoint;
auto errorCode = gatewayController.post(endpoint, payload, responseBody); auto errorCode = gatewayController.post(endpoint, payload, responseBody);
qDebug() << "TransferController::onTransferQrScanned: POST finished with code" qDebug() << "TransferController::onTransferQrScanned: POST finished with code"
<< static_cast<int>(errorCode); << static_cast<int>(errorCode);
@@ -276,12 +271,7 @@ void TransferController::startWaitForConfig(ImportController *importController)
break; break;
} }
QUrlQuery q; const QString endpoint = QStringLiteral("%1waitConfig").arg(gw);
q.addQueryItem(QStringLiteral("uuid"), uuid);
const QString endpoint = QStringLiteral("%1waitConfig?%2")
.arg(gw)
.arg(q.query(QUrl::FullyEncoded));
qDebug() << "waitConfig endpoint:" << endpoint; qDebug() << "waitConfig endpoint:" << endpoint;
QByteArray responseBody; QByteArray responseBody;
@@ -289,6 +279,8 @@ void TransferController::startWaitForConfig(ImportController *importController)
m_settings->isDevGatewayEnv(), m_settings->isDevGatewayEnv(),
apiDefs::requestTimeoutMsecs, apiDefs::requestTimeoutMsecs,
m_settings->isStrictKillSwitchEnabled()); m_settings->isStrictKillSwitchEnabled());
QJsonObject payload;
payload.insert(QStringLiteral("uuid"), uuid);
auto errorCode = gatewayController.get(endpoint, responseBody); auto errorCode = gatewayController.get(endpoint, responseBody);
if (errorCode == ErrorCode::NoError) { if (errorCode == ErrorCode::NoError) {