-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gRPC channel options #453
Comments
You can use an interceptor to set the user agent: let channel = Channel::from_static("http://[::1]:50051").connect().await?;
let mut client = GreeterClient::with_interceptor(channel, |mut req: Request<()>| {
req.metadata_mut().insert(
"x-user-agent",
MetadataValue::from_str("some-user-agent").unwrap(),
);
Ok(req)
}); |
You can't set the metadata key |
You are right, this is a bug. |
* Adds a default user-agent to tonic `Channel`. * The user agent can be configured through the `Channel` builder. fixes hyperium#453
* Add a default user-agent header to outgoing requests. * The user agent can be configured through the `Channel` builder. fixes #453
I also work with gRPC in Go and Python, and both have a way to use the channel options to do a number of things, in my specific case I'd like to set the
user-agent
header, which cannot be done via metadata.In Python it looks like this:
In Go, it looks like this:
I cannot find a way to do this with Tonic - am I missing this? Also, I unfortunately don't know anything about Hyper or Tower, so I don't know where to start implementing it.
The text was updated successfully, but these errors were encountered: