Commit 17143feb authored by Michelle Noorali's avatar Michelle Noorali

ref(helm): clean up callService

parent 899dc0b2
......@@ -91,14 +91,17 @@ func NewClient(c *cli.Context) *client.Client {
func callService(path, method, description string) ([]byte, error) {
dmURL := "http://localhost:8080"
//dmURL := "http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager"
var URL *url.URL
URL, err := url.Parse(dmURL)
//TODO: dmURL := "http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager"
client := &http.Client{}
url, err := formatPath(dmURL, path)
req, err := http.NewRequest(method, url.Path, nil)
if err != nil {
return nil, err
}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
URL.Path = strings.TrimRight(URL.String(), "/") + "/" + strings.TrimLeft(path, "/")
resp, err := http.Get(URL.Path) //TODO: change later
if err != nil {
return nil, err
}
......@@ -110,3 +113,13 @@ func callService(path, method, description string) ([]byte, error) {
}
return body, nil
}
func formatPath(rawURL, route string) (*url.URL, error) {
var URL *url.URL
URL, err := url.Parse(rawURL)
if err != nil {
return nil, err
}
URL.Path = strings.TrimRight(URL.String(), "/") + "/" + strings.TrimLeft(route, "/")
return URL, nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment