summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/shared/testhttpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/shared/testhttpserver.cpp')
-rw-r--r--tests/auto/declarative/shared/testhttpserver.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp
index 6c9d849..490fc95 100644
--- a/tests/auto/declarative/shared/testhttpserver.cpp
+++ b/tests/auto/declarative/shared/testhttpserver.cpp
@@ -115,6 +115,11 @@ void TestHTTPServer::addAlias(const QString &filename, const QString &alias)
aliases.insert(filename, alias);
}
+void TestHTTPServer::addRedirect(const QString &filename, const QString &redirectName)
+{
+ redirects.insert(filename, redirectName);
+}
+
bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body)
{
m_hasFailed = false;
@@ -230,6 +235,12 @@ void TestHTTPServer::readyRead()
bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName)
{
+ if (redirects.contains(fileName)) {
+ QByteArray response = "HTTP/1.1 302 Found\r\nContent-length: 0\r\nContent-type: text/html; charset=UTF-8\r\nLocation: " + redirects[fileName].toUtf8() + "\r\n\r\n";
+ socket->write(response);
+ return true;
+ }
+
for (int ii = 0; ii < dirs.count(); ++ii) {
QString dir = dirs.at(ii).first;
Mode mode = dirs.at(ii).second;