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

Function sanitizeBaseURL

internal/barista/observability/telemetry.twirp.go:637–646  ·  view source on GitHub ↗

sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. If the URL is unparsable, the baseURL is returned unchanged.

(baseURL string)

Source from the content-addressed store, hash-verified

635// sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed.
636// If the URL is unparsable, the baseURL is returned unchanged.
637func sanitizeBaseURL(baseURL string) string {
638 u, err := url.Parse(baseURL)
639 if err != nil {
640 return baseURL // invalid URL will fail later when making requests
641 }
642 if u.Scheme == "" {
643 u.Scheme = "http"
644 }
645 return u.String()
646}
647
648// baseServicePath composes the path prefix for the service (without <Method>).
649// e.g.: baseServicePath("/twirp", "my.pkg", "MyService")

Callers 2

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected