summaryrefslogtreecommitdiffstats
path: root/tests/auto/qhttpserver/tst_qhttpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qhttpserver/tst_qhttpserver.cpp')
-rw-r--r--tests/auto/qhttpserver/tst_qhttpserver.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qhttpserver/tst_qhttpserver.cpp b/tests/auto/qhttpserver/tst_qhttpserver.cpp
index 69b176c..a4e15af 100644
--- a/tests/auto/qhttpserver/tst_qhttpserver.cpp
+++ b/tests/auto/qhttpserver/tst_qhttpserver.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qmetaobject.h>
#include <QtCore/qjsonobject.h>
#include <QtCore/qjsonvalue.h>
+#include <QtCore/qjsonarray.h>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtNetwork/qnetworkreply.h>
@@ -205,6 +206,15 @@ void tst_QHttpServer::initTestCase()
};
});
+ httpserver.route("/json-array/", [] () {
+ return QJsonArray{
+ 1, "2",
+ QJsonObject{
+ {"name", "test"}
+ }
+ };
+ });
+
urlBase = QStringLiteral("http://localhost:%1%2").arg(httpserver.listen());
}
@@ -375,6 +385,12 @@ void tst_QHttpServer::routeGet_data()
<< 200
<< "application/json"
<< "{\"property\":\"test\",\"value\":1}";
+
+ QTest::addRow("json-array")
+ << "/json-array/"
+ << 200
+ << "application/json"
+ << "[1,\"2\",{\"name\":\"test\"}]";
}
void tst_QHttpServer::routeGet()