MCPcopy
hub / github.com/minio/minio-go / getEndpointURL

Function getEndpointURL

utils.go:109–128  ·  view source on GitHub ↗

getEndpointURL - construct a new endpoint.

(endpoint string, secure bool)

Source from the content-addressed store, hash-verified

107
108// getEndpointURL - construct a new endpoint.
109func getEndpointURL(endpoint string, secure bool) (*url.URL, error) {
110 // If secure is false, use 'http' scheme.
111 scheme := "https"
112 if !secure {
113 scheme = "http"
114 }
115
116 // Construct a secured endpoint URL.
117 endpointURLStr := scheme + "://" + endpoint
118 endpointURL, err := url.Parse(endpointURLStr)
119 if err != nil {
120 return nil, err
121 }
122
123 // Validate incoming endpoint URL.
124 if err := isValidEndpointURL(*endpointURL); err != nil {
125 return nil, err
126 }
127 return endpointURL, nil
128}
129
130// closeResponse close non nil response with any response Body.
131// convenient wrapper to drain any remaining data on response body.

Callers 2

privateNewFunction · 0.85
TestGetEndpointURLFunction · 0.85

Calls 1

isValidEndpointURLFunction · 0.85

Tested by 1

TestGetEndpointURLFunction · 0.68