diff options
author | Jani Honkonen <jani.honkonen@digia.com> | 2012-08-09 12:25:27 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-15 13:41:58 (GMT) |
commit | 59d7bac9fb37178d9ec025dd91fb32f08e655d4d (patch) | |
tree | 4e8a7fc6cbb7b5b58e03519b159d07002a5031c3 /tests/auto/declarative | |
parent | ccaf9dad3f0b2292b21abe6be1b11bc1b7b94e71 (diff) | |
download | Qt-59d7bac9fb37178d9ec025dd91fb32f08e655d4d.zip Qt-59d7bac9fb37178d9ec025dd91fb32f08e655d4d.tar.gz Qt-59d7bac9fb37178d9ec025dd91fb32f08e655d4d.tar.bz2 |
XMLHttpRequest does not support the DELETE method
This is a backport from qt5 commit:
0eeb925aa5039ffddf8d623f250980fc4c97712e
Task-number: QTBUG-17963
Change-Id: Ibc262e81d6c7d3b6882461627a7a312d1fbafb3b
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect (renamed from tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp | 23 |
4 files changed, 29 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml index c98555c..442932b 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml @@ -14,7 +14,7 @@ QtObject { // Test to the end x.onreadystatechange = function() { if (x.readyState == XMLHttpRequest.DONE) { - if (reqType == "HEAD") + if (reqType == "HEAD" || reqType == "DELETE") dataOK = (x.responseText == ""); else dataOK = (x.responseText == "QML Rocks!\n"); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect new file mode 100644 index 0000000..b2d177a --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_DELETE.expect @@ -0,0 +1,7 @@ +DELETE /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US +Connection: Keep-Alive +Accept-Encoding: gzip +User-Agent: Mozilla/5.0 +Host: 127.0.0.1:14445 + diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect index 74a9798..74a9798 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_HEAD.expect diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index f8c85b4..ea7b9b2 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -497,7 +497,7 @@ void tst_qdeclarativexmlhttprequest::send_alreadySent() delete object; } -// Test that send for a GET or HEAD ignores data +// Test that sends for GET, HEAD and DELETE ignore data void tst_qdeclarativexmlhttprequest::send_ignoreData() { { @@ -522,7 +522,7 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData() { TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_ignoreData_PUT.expect"), + QVERIFY(server.wait(TEST_FILE("send_ignoreData_HEAD.expect"), TEST_FILE("send_ignoreData.reply"), TEST_FILE("testdocument.html"))); @@ -537,6 +537,25 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData() delete object; } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_ignoreData_DELETE.expect"), + TEST_FILE("send_ignoreData.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("reqType", "DELETE"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QTRY_VERIFY(object->property("dataOK").toBool() == true); + + delete object; + } } // Test that send()'ing data works |