Cleanup async client APIs.

This commit is contained in:
Chunting Gu
2019-03-07 16:02:49 +08:00
parent ffa0794926
commit 31d0ea3c9d
74 changed files with 267 additions and 2106 deletions
+18 -1
View File
@@ -5,7 +5,7 @@
// -----------------------------------------------------------------------------
class TestRestService : public webcc::RestService {
public:
public:
void Handle(const webcc::RestRequest& request,
webcc::RestResponse* response) final {
response->status = webcc::http::Status::kOK;
@@ -37,6 +37,23 @@ TEST(RestServiceManager, URL_RegexBasic) {
EXPECT_FALSE(!!service);
}
TEST(RestServiceManager, URL_Temp) {
webcc::RestServiceManager service_manager;
service_manager.AddService(std::make_shared<TestRestService>(),
"/instance/([\\w.]+)", true);
std::vector<std::string> sub_matches;
std::string url = "/instance/123.45-+6aaa";
webcc::RestServicePtr service = service_manager.GetService(url, &sub_matches);
EXPECT_TRUE(!!service);
EXPECT_EQ(1, sub_matches.size());
EXPECT_EQ("123.45-6aaa", sub_matches[0]);
}
TEST(RestServiceManager, URL_RegexMultiple) {
webcc::RestServiceManager service_manager;