MCPcopy
hub / github.com/perkeep/perkeep / discoRoot

Method discoRoot

pkg/client/client.go:954–969  ·  view source on GitHub ↗

discoRoot returns the user defined server for this client. It prepends "https://" if no scheme was specified.

()

Source from the content-addressed store, hash-verified

952
953// discoRoot returns the user defined server for this client. It prepends "https://" if no scheme was specified.
954func (c *Client) discoRoot() string {
955 s := c.server
956 if c.sameOrigin {
957 s = strings.TrimPrefix(s, "http://")
958 s = strings.TrimPrefix(s, "https://")
959 parts := strings.SplitN(s, "/", 1)
960 if len(parts) < 2 {
961 return "/"
962 }
963 return "/" + parts[1]
964 }
965 if !strings.HasPrefix(s, "http") {
966 s = "https://" + s
967 }
968 return s
969}
970
971// initPrefix uses the user provided server URL to define the URL
972// prefix to the blobserver root. If the server URL has a path

Callers 8

useTLSMethod · 0.95
versionMismatchMethod · 0.95
initPrefixMethod · 0.95
HTTPVersionMethod · 0.95
discoveryRespMethod · 0.95
doDiscoveryMethod · 0.95
GetJSONMethod · 0.95
postMethod · 0.95

Calls 1

HasPrefixMethod · 0.80

Tested by

no test coverage detected