From cb9e6a7d90035cd50e389f000df1a3103e312af0 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Fri, 31 Jul 2020 16:02:36 +0200 Subject: Simplify testing with HttpServer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since reply with 404 for unknown resources is a common pattern in tests, reply with it automatically for unhandled requests Change-Id: Ifd184cf474f1ec311c8654dfbacdd735e33d7c97 Reviewed-by: Jüri Valdmann --- .../tst_qwebengineurlrequestinterceptor.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp') diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 350c15174..aad7a205c 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -203,10 +203,8 @@ private: QString path = rr->requestPath(); path.remove(0, 1); - if (rr->requestMethod() != "GET" || !resourceDir.exists(path)) - { - rr->setResponseStatus(404); - rr->sendResponse(); + if (rr->requestMethod() != "GET" || !resourceDir.exists(path)) { + rr->sendResponse(404); return; } @@ -663,7 +661,6 @@ void tst_QWebEngineUrlRequestInterceptor::passRefererHeader() const QByteArray headerValue = rr->requestHeader(kHttpHeaderRefererName); QCOMPARE(headerValue, kHttpHeaderReferrerValue); succeeded = headerValue == kHttpHeaderReferrerValue; - rr->setResponseStatus(200); rr->sendResponse(); }); -- cgit v1.2.3