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

Function getHostname

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

283// explicit Host override and falling back to the URL host. Any port in the host
284// is stripped, so callers compare on the hostname alone.
285func getHostname(r *http.Request) string {
286 host := r.Host
287 if host == "" {
288 host = r.URL.Host
289 }
290 return (&url.URL{Host: host}).Hostname()
291}
292
293type telemetryDisablerTransport struct {
294 wrappedTransport http.RoundTripper

Callers 2

RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected