diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h index 49a3e9461cfc772b8eae096c37c157a5636b60ca..37de51e813d5e715cf6eccbc888e0e074dd97841 100644 --- a/include/grpc++/support/channel_arguments.h +++ b/include/grpc++/support/channel_arguments.h @@ -90,6 +90,10 @@ class ChannelArguments { /// grpclb LB policy will be used, regardless of what is specified here. void SetLoadBalancingPolicyName(const grpc::string& lb_policy_name); + /// Set service config in JSON form. + /// Primarily meant for use in unit tests. + void SetServiceConfigJSON(const grpc::string& service_config_json); + // Generic channel argument setters. Only for advanced use cases. /// Set an integer argument \a value under \a key. void SetInt(const grpc::string& key, int value); diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index d86ba9dd4e8c4760a80d7f299787ff3e61943830..305ea0f14cc770a1c1abcbddb307590018ca4cce 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -125,6 +125,11 @@ void ChannelArguments::SetLoadBalancingPolicyName( SetString(GRPC_ARG_LB_POLICY_NAME, lb_policy_name); } +void ChannelArguments::SetServiceConfigJSON( + const grpc::string& service_config_json) { + SetString(GRPC_ARG_SERVICE_CONFIG, service_config_json); +} + void ChannelArguments::SetInt(const grpc::string& key, int value) { grpc_arg arg; arg.type = GRPC_ARG_INTEGER;