Skip to content

Commit

Permalink
add unit_test for wildcard http method. (istio#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiwzhang authored Jun 14, 2017
1 parent 7f8caa5 commit 19fafc2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contrib/endpoints/src/api_manager/path_matcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,22 @@ TEST_F(PathMatcherTest, WildCardMatches) {
EXPECT_EQ(LookupNoBindings("GET", "/c/f/d/e"), cfde);
}

TEST_F(PathMatcherTest, WildCardMethodMatches) {
MethodInfo* a__ = AddPath("*", "/a/**");
MethodInfo* b_ = AddPath("*", "/b/*");
Build();

EXPECT_NE(nullptr, a__);
EXPECT_NE(nullptr, b_);

std::vector<std::string> all_methods{"GET", "POST", "DELETE", "PATCH", "PUT"};
for (const auto& method : all_methods) {
EXPECT_EQ(LookupNoBindings(method, "/a/b"), a__);
EXPECT_EQ(LookupNoBindings(method, "/a/b/c"), a__);
EXPECT_EQ(LookupNoBindings(method, "/b/c"), b_);
}
}

TEST_F(PathMatcherTest, VariableBindings) {
MethodInfo* a_cde = AddGetPath("/a/{x}/c/d/e");
MethodInfo* a_b_c = AddGetPath("/{x=a/*}/b/{y=*}/c");
Expand Down

0 comments on commit 19fafc2

Please sign in to comment.