From fd5dd2712656cbc674c8360754394e41dd82e40c Mon Sep 17 00:00:00 2001 From: Mandeep Sandhu Date: Fri, 15 Nov 2013 18:42:22 +0530 Subject: Add more specific HTTP error codes to QNetworkReply::NetworkError A few more HTTP status codes from the 4xx and 5xx series have been added to QNetworkReply::NetworkError. For content errors, the following codes have been added: 1. 409 - Resource Conflict 2. 410 - Resource Gone For server related errors, the following codes have been added: 1. 500 - Internal Server Error 2. 501 - Operation Not Implemented 3. 503 - Service Unavailable Few of the above codes are quite possible when communicating with REST based services. NOTE: ===== * HTTP error status 400 is interpreted as QNetworkReply::ProtocolInvalidOperationError. * QNetworkReply::UnknownServerError is returned for all server related errors (5xx) not listed above. [ChangeLog][QtNetwork][QNetworkReply] Added more (specific) HTTP status codes to NetworkError enum. Task-number: QTBUG-30880 Change-Id: I9d2a133f6b3869f26710c6eb930dd8b08df31108 Reviewed-by: Peter Hartmann --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 4d5748b419..8e13c1de6e 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -2856,9 +2856,9 @@ void tst_QNetworkReply::sendCustomRequestToHttp_data() QTest::newRow("trace") << QUrl("http://" + QtNetworkSettings::serverName()) << QByteArray("TRACE") << (QBuffer *) 0 << 200 << QNetworkReply::NoError << QByteArray(); QTest::newRow("connect") << QUrl("http://" + QtNetworkSettings::serverName()) << - QByteArray("CONNECT") << (QBuffer *) 0 << 400 << QNetworkReply::UnknownContentError << QByteArray(); // 400 = Bad Request + QByteArray("CONNECT") << (QBuffer *) 0 << 400 << QNetworkReply::ProtocolInvalidOperationError << QByteArray(); // 400 = Bad Request QTest::newRow("nonsense") << QUrl("http://" + QtNetworkSettings::serverName()) << - QByteArray("NONSENSE") << (QBuffer *) 0 << 501 << QNetworkReply::ProtocolUnknownError << QByteArray(); // 501 = Method Not Implemented + QByteArray("NONSENSE") << (QBuffer *) 0 << 501 << QNetworkReply::OperationNotImplementedError << QByteArray(); // 501 = Method Not Implemented QByteArray ba("test"); QBuffer *buffer = new QBuffer; -- cgit v1.2.3