From 1137678bbadb7a687f719d6d68bc75fd371d6840 Mon Sep 17 00:00:00 2001 From: linhaojun857 Date: Sun, 26 Nov 2023 23:49:20 +0800 Subject: [PATCH] Add test sample for HttpRouter --- test/oatpp/web/server/HttpRouterTest.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/oatpp/web/server/HttpRouterTest.cpp b/test/oatpp/web/server/HttpRouterTest.cpp index 187ddd9e..346f9f69 100644 --- a/test/oatpp/web/server/HttpRouterTest.cpp +++ b/test/oatpp/web/server/HttpRouterTest.cpp @@ -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") + } + } }}}}