Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add new method get_uri for Endpoint #371

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tonic/src/transport/channel/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ impl Endpoint {

Channel::connect(connector, self.clone()).await
}

/// Get the endpoint uri.
///
/// ```
/// # use tonic::transport::Endpoint;
/// # use http::Uri;
/// let endpoint = Endpoint::from_static("https://example.com");
///
/// assert_eq!(endpoint.get_uri(), &Uri::from_static("https://example.com"));
/// ```
pub fn get_uri(&self) -> &Uri {
&self.uri
}
}

impl From<Uri> for Endpoint {
Expand Down