@@ -77,6 +77,7 @@ class PathMatcher {
77
77
Method method;
78
78
std::vector<HttpTemplate::Variable> variables;
79
79
std::string body_field_path;
80
+ std::set<std::string> system_query_parameter_names;
80
81
};
81
82
// The info associated with each method. The path matcher nodes
82
83
// will hold pointers to MethodData objects in this vector.
@@ -104,8 +105,12 @@ class PathMatcherBuilder {
104
105
// Registrations are one-to-one. If this function is called more than once, it
105
106
// replaces the existing method. Only the last registered method is stored.
106
107
// Return false if path is an invalid http template.
107
- bool Register (std::string http_method, std::string path,
108
- std::string body_field_path, Method method);
108
+ bool Register (const std::string& http_method, const std::string& path,
109
+ const std::string& body_field_path,
110
+ const std::set<std::string>& system_query_parameter_names,
111
+ Method method);
112
+ bool Register (const std::string& http_method, const std::string& path,
113
+ const std::string& body_field_path, Method method);
109
114
110
115
// Returns a unique_ptr to a thread safe PathMatcher that contains all
111
116
// registered path-WrapperGraph pairs. Note the PathMatchBuilder instance
@@ -412,7 +417,7 @@ Method PathMatcher<Method>::Lookup(
412
417
variable_bindings->clear ();
413
418
ExtractBindingsFromPath (method_data->variables , parts, variable_bindings);
414
419
ExtractBindingsFromQueryParameters (
415
- query_params, method_data->method -> system_query_parameter_names () ,
420
+ query_params, method_data->system_query_parameter_names ,
416
421
variable_bindings);
417
422
}
418
423
if (body_field_path != nullptr ) {
@@ -468,9 +473,10 @@ void PathMatcherBuilder<Method>::InsertPathToNode(
468
473
// This wrapper converts the |http_rule| into a HttpTemplate. Then, inserts the
469
474
// template into the trie.
470
475
template <class Method >
471
- bool PathMatcherBuilder<Method>::Register(std::string http_method,
472
- std::string http_template,
473
- std::string body_field_path,
476
+ bool PathMatcherBuilder<Method>::Register(const std::string& http_method,
477
+ const std::string& http_template,
478
+ const std::string& body_field_path,
479
+ const std::set<std::string>& system_query_parameter_names,
474
480
Method method) {
475
481
std::unique_ptr<HttpTemplate> ht (HttpTemplate::Parse (http_template));
476
482
if (nullptr == ht) {
@@ -485,7 +491,8 @@ bool PathMatcherBuilder<Method>::Register(std::string http_method,
485
491
auto method_data = std::unique_ptr<MethodData>(new MethodData ());
486
492
method_data->method = method;
487
493
method_data->variables = std::move (ht->Variables ());
488
- method_data->body_field_path = std::move (body_field_path);
494
+ method_data->body_field_path = body_field_path;
495
+ method_data->system_query_parameter_names = system_query_parameter_names;
489
496
490
497
InsertPathToNode (path_info, method_data.get (), http_method, true ,
491
498
root_ptr_.get ());
@@ -494,6 +501,14 @@ bool PathMatcherBuilder<Method>::Register(std::string http_method,
494
501
return true ;
495
502
}
496
503
504
+ template <class Method >
505
+ bool PathMatcherBuilder<Method>::Register(const std::string& http_method,
506
+ const std::string& http_template,
507
+ const std::string& body_field_path,
508
+ Method method) {
509
+ return Register (http_method, http_template, body_field_path, {}, method);
510
+ }
511
+
497
512
} // namespace transcoding
498
513
} // namespace grpc
499
514
} // namespace google
0 commit comments