aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlxmlhttprequest.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@nokia.com>2012-04-18 14:55:02 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-01 06:06:51 +0200
commit0949071f13e7bcbc16a0f07f496e0b6a23b04edd (patch)
tree26aba383a6484a455874cb9d8b0f561598e51ae3 /src/qml/qml/qqmlxmlhttprequest.cpp
parente39908c658c6caa2013bc7356eb904b669af1bfb (diff)
Keep XMLHttpRequest response data after receiving a server error
Fix XMLHttpRequest.responseText being set to empty string whenever a server status code other than '200/OK' is received. XMLHttpRequest specification says that response entity body is to be returned unless the error flag is set, and the flag is set only in case of abort() or network error. This change enables clients to receive additional error information the server may return in the response body. http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute Task-number: QTBUG-21706 Change-Id: I7e44f481494dc7eddea3868d6f92ee45d7ab0c69 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlxmlhttprequest.cpp')
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 94ee7c7dc3..e829b8b072 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1281,14 +1281,11 @@ void QQmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
{
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();
@@ -1310,6 +1307,7 @@ void QQmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
if (tc.HasCaught()) printError(tc.Message());
} else {
m_errorFlag = true;
+ m_responseEntityBody = QByteArray();
}
m_state = Done;