MCPcopy Create free account
hub / github.com/cloudfoundry/multiapps-cli-plugin / Build

Method Build

util/builders.go:78–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func (builder *UriBuilder) Build() (string, error) {
79 if builder.scheme == "" || builder.host == "" {
80 return "", fmt.Errorf("The host or scheme could not be empty")
81 }
82 stringBuilder := bytes.Buffer{}
83 stringBuilder.WriteString(builder.scheme)
84 stringBuilder.WriteString(hostAndSchemeSeparator)
85 stringBuilder.WriteString(builder.host)
86 stringBuilder.WriteString(getPath(builder.path))
87 builtUrl := stringBuilder.String()
88 parsedUrl, err := url.Parse(builtUrl)
89 if err != nil {
90 return "", err
91 }
92 return parsedUrl.String(), nil
93}
94
95func getPath(path string) string {
96 if strings.HasPrefix(path, "/") {

Callers 4

builders_test.goFile · 0.45
cf_context_test.goFile · 0.45

Calls 3

getPathFunction · 0.85
StringMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected