Merge pull request #896 from linhaojun857/add_test_sample

Add test sample for HttpRouter
This commit is contained in:
Leonid Stryzhevskyi 2023-12-05 06:22:39 +02:00 committed by GitHub
commit 57e6a714d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,6 +166,26 @@ void HttpRouterTest::onRun() {
OATPP_ASSERT(r.getMatchMap().getTail() == "abc")
}
{
OATPP_LOGI(TAG, "Case 15")
auto r = router.getRoute("GET", "ints/1?q1=1&q2=2");
OATPP_ASSERT(r.isValid())
OATPP_ASSERT(r)
OATPP_ASSERT(r.getEndpoint() == 1)
OATPP_ASSERT(r.getMatchMap().getTail() == "?q1=1&q2=2")
}
{
OATPP_LOGI(TAG, "Case 16")
auto r = router.getRoute("GET", "ints/all/3?q1=1&q2=2");
OATPP_ASSERT(r.isValid())
OATPP_ASSERT(r)
OATPP_ASSERT(r.getEndpoint() == -1)
OATPP_ASSERT(r.getMatchMap().getVariables().size() == 1)
OATPP_ASSERT(r.getMatchMap().getVariable("value") == "3")
OATPP_ASSERT(r.getMatchMap().getTail() == "?q1=1&q2=2")
}
}
}}}}