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

Function getHostname

api/http_client.go:219–225  ·  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

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.
219func 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
227type telemetryDisablerTransport struct {
228 wrappedTransport http.RoundTripper

Callers 2

AddAuthTokenHeaderFunction · 0.85
RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected