getHostname returns the hostname the request is addressed to, preferring an explicit Host override and falling back to the URL host. Any port in the host is stripped, so callers compare on the hostname alone.
(r *http.Request)
| 217 | // explicit Host override and falling back to the URL host. Any port in the host |
| 218 | // is stripped, so callers compare on the hostname alone. |
| 219 | func getHostname(r *http.Request) string { |
| 220 | host := r.Host |
| 221 | if host == "" { |
| 222 | host = r.URL.Host |
| 223 | } |
| 224 | return (&url.URL{Host: host}).Hostname() |
| 225 | } |
| 226 | |
| 227 | type telemetryDisablerTransport struct { |
| 228 | wrappedTransport http.RoundTripper |
no outgoing calls
no test coverage detected