API capability registry for a given host. Exact matches win, then wildcard host overlap is used so credentialed wildcard proposals can be evaluated against concrete API capability registries.
(&self, host: &str)
| 154 | /// wildcard host overlap is used so credentialed wildcard proposals can be |
| 155 | /// evaluated against concrete API capability registries. |
| 156 | pub fn api_for_host(&self, host: &str) -> Option<&ApiCapability> { |
| 157 | let needle = normalize_host(host); |
| 158 | self.api_registries |
| 159 | .values() |
| 160 | .find(|api| normalize_host(&api.host) == needle) |
| 161 | .or_else(|| { |
| 162 | self.api_registries |
| 163 | .values() |
| 164 | .find(|api| host_patterns_overlap(host, &api.host)) |
| 165 | }) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | fn normalize_host(host: &str) -> String { |