Skip to content

Commit 22160af

Browse files
authored
path PR#46 (#47)
1 parent f7720be commit 22160af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/include/grpc_transcoding/path_matcher.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,7 @@ bool PathMatcherBuilder<Method>::Register(
531531
return false;
532532
}
533533
PathMatcherNode::PathInfo path_info = TransformHttpTemplate(*ht);
534-
if (path_info.path_info().size() == 0) {
535-
return false;
536-
}
534+
537535
// Create & initialize a MethodData struct. Then insert its pointer
538536
// into the path matcher trie.
539537
auto method_data = std::unique_ptr<MethodData>(new MethodData());

test/path_matcher_test.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ TEST_F(PathMatcherTest, WildCardMatches) {
206206
EXPECT_NE(nullptr, c_d__);
207207
EXPECT_NE(nullptr, c_de);
208208
EXPECT_NE(nullptr, cfde);
209+
EXPECT_NE(nullptr, root);
209210

210211
EXPECT_EQ(LookupNoBindings("GET", "/a/b"), a__);
211212
EXPECT_EQ(LookupNoBindings("GET", "/a/b/c"), a__);
212213
EXPECT_EQ(LookupNoBindings("GET", "/b/c"), b_);
213-
EXPECT_EQ(LookupNoBindings("GET", "/"), root);
214214

215215
EXPECT_EQ(LookupNoBindings("GET", "b/c/d"), nullptr);
216216
EXPECT_EQ(LookupNoBindings("GET", "/c/u/d/v"), c_d__);
@@ -222,6 +222,8 @@ TEST_F(PathMatcherTest, WildCardMatches) {
222222
EXPECT_EQ(LookupNoBindings("GET", "/c/x/d/e"), c_de);
223223
// Test that more specific match overrides wildcard "*"" match.
224224
EXPECT_EQ(LookupNoBindings("GET", "/c/f/d/e"), cfde);
225+
226+
EXPECT_EQ(LookupNoBindings("GET", "/"), root);
225227
}
226228

227229
TEST_F(PathMatcherTest, VariableBindings) {

0 commit comments

Comments
 (0)