Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121504

[wasm] Unable to set Content-Type of 1st http post

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • None
    • 6.7.0 Beta1
    • Network
    • None
    • WebAssembly

      Here is my test code:

      #include <QCoreApplication>
      #include <QNetworkAccessManager>
      #include <QNetworkRequest>
      #include <QNetworkReply>
      #include <QUrl>
      
      QNetworkAccessManager *g_Manager = nullptr;
      void post();
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);    
            QNetworkAccessManager manager;
          g_Manager = &manager;   
      
            post();
          post();    
      
            return a.exec();
      }
      
      void post()
      {
          QEventLoop eventLoop;
          QObject::connect(g_Manager, &QNetworkAccessManager::finished, &eventLoop, &QEventLoop::quit);    
      
            QNetworkRequest request(QUrl("http://localhost/api/test"));
          request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
          QNetworkReply *reply = g_Manager->post(request, "{}");
          eventLoop.exec();    
      
            reply->deleteLater();
      }
        

      First request have no Content-Type header.

      Patch 6.6.1 using the fix from QTBUG-109396 can also reproduce this.

       

        For Gerrit Dashboard: QTBUG-121504
        # Subject Branch Project Status CR V

            lpotter Lorn Potter
            vabawen Huang Qihui
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes