mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #497, improved URL and network utils
* utility functions * URL, allow to switch to https * Adjusted database writer
This commit is contained in:
committed by
Mathew Sutcliffe
parent
03f4aa6889
commit
7cb4c6a6c6
@@ -18,6 +18,7 @@
|
||||
#include <QHttpMultiPart>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackCore
|
||||
@@ -47,21 +48,9 @@ namespace BlackCore
|
||||
|
||||
QUrl url(m_modelUrl.toQUrl());
|
||||
QNetworkRequest request(url);
|
||||
const QByteArray jsonData(QJsonDocument(model.toJson()).toJson(QJsonDocument::Compact));
|
||||
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||
QHttpPart textPart;
|
||||
QString name("form-data; name=\"swiftjson\"");
|
||||
textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(name));
|
||||
textPart.setBody(jsonData);
|
||||
multiPart->append(textPart);
|
||||
|
||||
if (m_phpDebug && CProject::isRunningInDeveloperEnvironment())
|
||||
{
|
||||
QHttpPart textPartDebug;
|
||||
textPartDebug.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"XDEBUG_SESSION_START\""));
|
||||
textPartDebug.setBody(QString("ECLIPSE_DBGP").toUtf8());
|
||||
multiPart->append(textPartDebug);
|
||||
}
|
||||
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
|
||||
multiPart->append(CNetworkUtils::getJsonTextMutlipart(model.toJson()));
|
||||
if (m_setup.get().dbDebugFlag()) { multiPart->append(CNetworkUtils::getMultipartWithDebugFlag()); }
|
||||
|
||||
m_pendingReply = this->m_networkManager->post(request, multiPart);
|
||||
multiPart->setParent(m_pendingReply);
|
||||
|
||||
Reference in New Issue
Block a user