https nodejs server resolve wrong body data from QHttpMultiPart



  • Hi,
    I write a https server with nodejs. It works fine when I use JMeter to test the ability of file uploading. And I can get the token from body. But when I post only token through QHttpMultiPart I get the wrong body property: req.body."--boundary_.oOo._MTc5MTk"= "Mjg5Mzc=MzE0OTA=Content-Disposition: form-data;na". Here "--boundary_.oOo._MTc5MTk" is parsed to the only property of body. I used Qt5.7.1. Here is my code for test and recieve same results as describes:

    QHttpMultiPart* pMutipart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    QHttpPart partParams;
    partParams.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data;name=\"hello\""));
    partParams.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
    partParams.setBody("world");
    pMutipart->append(partParams);
    m_pManager->post(m_request, pMutipart);
    

    Does these code have any wrong?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.