mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Merge pull request #896 from linhaojun857/add_test_sample
Add test sample for HttpRouter
This commit is contained in:
commit
57e6a714d7
@ -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")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}}}}
|
||||
|
Loading…
Reference in New Issue
Block a user