mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2025-01-03 05:22:24 +08:00
Add test sample for HttpRouter
This commit is contained in:
parent
1d11558e2c
commit
1137678bba
@ -166,6 +166,26 @@ void HttpRouterTest::onRun() {
|
|||||||
OATPP_ASSERT(r.getMatchMap().getTail() == "abc")
|
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