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

Function getHostname

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

331// explicit Host override and falling back to the URL host. Any port in the host
332// is stripped, so callers compare on the hostname alone.
333func getHostname(r *http.Request) string {
334 host := r.Host
335 if host == "" {
336 host = r.URL.Host
337 }
338 return (&url.URL{Host: host}).Hostname()
339}
340
341type telemetryDisablerTransport struct {
342 wrappedTransport http.RoundTripper

Callers 2

RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected