diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2020-07-31 16:02:36 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2020-08-31 10:04:32 +0200 |
commit | cb9e6a7d90035cd50e389f000df1a3103e312af0 (patch) | |
tree | 75b5bb8b3bf79c2ec6fc9bbcc88b29d111402d33 /tests/auto/core/qwebengineurlrequestinterceptor | |
parent | e30208ed4d8c2396f0a9c3330b9aefd6c7c91157 (diff) |
Simplify testing with HttpServer
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 <juri.valdmann@qt.io>
Diffstat (limited to 'tests/auto/core/qwebengineurlrequestinterceptor')
-rw-r--r-- | tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
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(); }); |