aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-02-17 10:21:31 -0800
committerGravatar Yang Gao <yangg@google.com>2015-02-17 10:21:31 -0800
commitf2c0ca4c6296dddfc46d84c8d2b422eff3531551 (patch)
tree0bf5b3661683efbdfb7fbe329ca4b147616be4c0 /src
parent573523f1278a8c797c10ebb2a8b571d6891a22cc (diff)
Add setter to override authority header on ClientContext
Diffstat (limited to 'src')
-rw-r--r--src/cpp/client/channel.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index 440423dba9..c4794d717d 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -81,8 +81,11 @@ Channel::~Channel() { grpc_channel_destroy(c_channel_); }
Call Channel::CreateCall(const RpcMethod &method, ClientContext *context,
CompletionQueue *cq) {
auto c_call =
- grpc_channel_create_call(c_channel_, cq->cq(), method.name(),
- target_.c_str(), context->RawDeadline());
+ grpc_channel_create_call(
+ c_channel_, cq->cq(), method.name(),
+ context->authority().empty() ? target_.c_str()
+ : context->authority(),
+ context->RawDeadline());
context->set_call(c_call);
return Call(c_call, this, cq);
}