MCPcopy Create free account
hub / github.com/cli/cli / getHostname

Function getHostname

api/http_client.go:306–312  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

304// explicit Host override and falling back to the URL host. Any port in the host
305// is stripped, so callers compare on the hostname alone.
306func getHostname(r *http.Request) string {
307 host := r.Host
308 if host == "" {
309 host = r.URL.Host
310 }
311 return (&url.URL{Host: host}).Hostname()
312}
313
314type telemetryDisablerTransport struct {
315 wrappedTransport http.RoundTripper

Callers 2

RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected