From 80e0d0e08eaccf032c4a42ce7c5d3ffb91837141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 7 May 2020 15:20:55 +0200 Subject: 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 --- tests/auto/network/access/http2/http2srv.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/network/access/http2/http2srv.cpp') 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); -- cgit v1.2.3