title: Correct format for HTTP POST using QNetworkRequest
body: <p>I'm trying to send a JSON query to a web service and I continue to get internal server errors as a response to the query.</p>
  
  <p>Here is what I'm trying to send:</p>
  
  <pre><code>POST /api/1.7/webservice.asmx HTTP/1.1
  Host: www.superService.com
  User-Agent: My app name v0.1
  X-Custom-User-Agent: My app name v0.1
  Content-Type: application/json
  Content-Length:81
  
  {"method":"AuthenticatePlain","loginName":"username@domain.com","password":"mypass"}
  </code></pre>
  
  <p>This is supposed to be sent to  <a href="https://www.superService.com/api/1.7/ssapi.asmx" rel="nofollow noreferrer">https://www.superService.com/api/1.7/ssapi.asmx</a></p>
  
  <p>In preparing the <code>QNetworkRequest</code>, what method is used to insert the line </p>
  
  <p><strong>POST /api/1.7/webservice.asmx HTTP/1.1</strong>?</p>
  
  <p>Is the complete header contained in the <code>QNetworkRequest</code> object?<br>
  Should the JSON data be in the <code>QNetworkRequest</code> object or is that added to the post as the second argument in the <code>QNetworkAccessManager::post()</code> method?</p>
  
  <p>Here is my current code in the <code>on_btnLogin_clicked()</code> slot:</p>
  
  <pre><code>connect(m_qnam, SIGNAL(finished(QNetworkReply*)),
                   this, SLOT(handleNetworkData(QNetworkReply*)));
      connect(m_qnam,SIGNAL(sslErrors(QNetworkReply*,QList&lt;QSslError&gt;)),
                   this, SLOT(handleSSLErrors(QNetworkReply*)));
  
      QString baseString = "";
      baseString.append(QString("POST /api/1.7/webservice.asmx HTTP/1.1\r\n").toUtf8());  
      baseString.append(QString("www.superService.com\r\n").toUtf8());
      baseString.append(QString("User-Agent: My app name v0.1\r\n").toUtf8());
      baseString.append(QString("X-Custom-User-Agent: My app name v0.1\r\n").toUtf8());
      baseString.append(QString("Content-Type: application/json\r\n").toUtf8());
  
      QString jsonString = QString("{");
      jsonString.append("\"method\":");
      jsonString.append("\"AuthenticatePlain\"");
      jsonString.append(",\"loginName\":");
      jsonString.append("\"username@domain.com\"");
      jsonString.append(",\"password\":");
      jsonString.append("\"mypass\"");
      jsonString.append("}");
  
      QByteArray json = jsonString.toUtf8();
  
      baseString.append(QString("Content-Length:").toUtf8());
      baseString.append(QString::number(json.length()));
      baseString.append("\r\n").toUtf8();
      baseString.append(QString("\r\n").toUtf8());
      baseString.append(json);
  
      request = QNetworkRequest(QUrl("https://www.superService.com/api/1.7/ssapi.asmx"));
      request.setRawHeader()
  
  
      qDebug() &lt;&lt; "Base String: "&lt;&lt; baseString;
  
  
      m_qnam-&gt;post(request,baseString.toUtf8());
  </code></pre>