Add a way to test/inspect server and router build/configuration
- Dominant language
- Rust
- Stars
- 12.5k
- Forks
- 1.3k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 24
Description
## Feature Request
### Motivation
For example, let's say I want to parse a configuration file to build my tonic server:
```rust
// Let's exclude the file parsing code since it's not the focus here
struct MyTonicConfig {
http1: bool,
concurrency_limit: Option,
keep_alive: Option,
}
fn build_tonic_by_config(config: MyTonicConfig) -> tonic::transport::Server {
let mut my_tonic_server = Server::builder();
if config.http1 {
my_tonic_server = my_tonic_server.accept_http1(true);
}
if let Some(concurrency_limit) = config.concurrency_limit {
my_tonic_server = my_tonic_server.concurrency_limit_per_connection(concurrency_limit);
}
my_tonic_server = my_tonic_server.http2_keepalive_timeout(config.keep_alive);
my_tonic_server
}
```
I would like to be able to inspect the resulting tonic server to be sure my code is working as expected, but I can't find any getter for `tonic::transportation::Server` fields.
Similar, but I think more complicated, scenario I think is applicable for Router and Routes.
### Proposal
The simplest solution I can think is to add getters for `tonic::transportaion:Server`
### Alternatives
1. Implement an "expect" like method that can compare `tonic::transportaion:Server` fields value with given test value.
2. Implement `PartialEq`/`Eq` for `tonic::transportaion:Server`
Contributor guide
Assessment
This issue has not been assessed yet.