Skip to content

Commit

Permalink
Simplify previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaure-kdab committed Aug 21, 2024
1 parent 84fff36 commit 51de1cc
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions unittests/serverlib/test_serverlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,18 +1345,10 @@ private Q_SLOTS:
loop.exec();
reply->readAll();

const bool titleCase = reply->rawHeaderList().contains("Access-Control-Allow-Origin");
const bool lowerCase = reply->rawHeaderList().contains("access-control-allow-origin");
QVERIFY(titleCase || lowerCase);
if (titleCase) {
QCOMPARE(reply->rawHeader("Access-Control-Allow-Origin").constData(), "*");
QVERIFY(reply->rawHeaderList().contains("Access-Control-Allow-Headers"));
QCOMPARE(reply->rawHeader("Access-Control-Allow-Headers").constData(), "Content-Type");
} else { // Qt >= 6.8
QCOMPARE(reply->rawHeader("access-control-allow-origin").constData(), "*");
QVERIFY(reply->rawHeaderList().contains("access-control-allow-headers"));
QCOMPARE(reply->rawHeader("access-control-allow-headers").constData(), "Content-Type");
}
QVERIFY(reply->hasRawHeader("Access-Control-Allow-Origin"));
QCOMPARE(reply->rawHeader("Access-Control-Allow-Origin").constData(), "*");
QVERIFY(reply->hasRawHeader("Access-Control-Allow-Headers"));
QCOMPARE(reply->rawHeader("Access-Control-Allow-Headers").constData(), "Content-Type");
}

void testTimeout()
Expand Down

0 comments on commit 51de1cc

Please sign in to comment.