{
v8::HandleScope handle_scope;
- Q_UNUSED(error)
m_status =
m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
m_statusText =
QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
- m_responseEntityBody = QByteArray();
-
m_request = QNetworkRequest();
m_data.clear();
destroyNetwork();
if (tc.HasCaught()) printError(tc.Message());
} else {
m_errorFlag = true;
+ m_responseEntityBody = QByteArray();
}
m_state = Done;
HTTP/1.0 400 Bad request
Connection: close
Content-type: text/html; charset=UTF-8
-
if (x.status == expectedStatus)
done = true;
- if (expectedStatus != 200) {
- dataOK = (x.responseText == "");
- } else {
- dataOK = (x.responseText == "QML Rocks!\n");
- }
+ dataOK = (x.responseText == "QML Rocks!\n");
x.open("GET", url);
x.setRequestHeader("Accept-Language", "en-US");
if (x.statusText == expectedStatus)
done = true;
- if (expectedStatus != "OK") {
- dataOK = (x.responseText == "");
- } else {
- dataOK = (x.responseText == "QML Rocks!\n");
- }
+ dataOK = (x.responseText == "QML Rocks!\n");
x.open("GET", url);
x.setRequestHeader("Accept-Language", "en-US");
QTest::newRow("OK") << testFileUrl("status.200.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
- QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "";
- QTest::newRow("Bad Request") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "";
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
}
void tst_qqmlxmlhttprequest::nonUtf8()