summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/http2/http2srv.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2020-05-07 15:20:55 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2020-05-13 13:54:44 +0200
commit80e0d0e08eaccf032c4a42ce7c5d3ffb91837141 (patch)
tree8b9acabac005e0abeab1f519cb94c477ccc74e24 /tests/auto/network/access/http2/http2srv.cpp
parentb35551a75e37d4ae1ddb024a82c67cdba714879a (diff)
QNetworkReply/http2: Add a contentEncoding test
Will be useful when DecompressHelper gets taken into use for both. Task-number: QTBUG-83269 Change-Id: Iaf253219bed193025c2b82d6609f4dcc4de33df8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/access/http2/http2srv.cpp')
-rw-r--r--tests/auto/network/access/http2/http2srv.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp
index a8eebf5a24..9513744476 100644
--- a/tests/auto/network/access/http2/http2srv.cpp
+++ b/tests/auto/network/access/http2/http2srv.cpp
@@ -120,6 +120,11 @@ void Http2Server::setResponseBody(const QByteArray &body)
responseBody = body;
}
+void Http2Server::setContentEncoding(const QByteArray &encoding)
+{
+ contentEncoding = encoding;
+}
+
void Http2Server::emulateGOAWAY(int timeout)
{
Q_ASSERT(timeout >= 0);
@@ -841,6 +846,9 @@ void Http2Server::sendResponse(quint32 streamID, bool emptyBody)
QString("%1").arg(responseBody.size()).toLatin1()));
}
+ if (!contentEncoding.isEmpty())
+ header.push_back(HPack::HeaderField("content-encoding", contentEncoding));
+
HPack::BitOStream ostream(writer.outboundFrame().buffer);
const bool result = encoder.encodeResponse(ostream, header);
Q_ASSERT(result);