diff --git a/go.mod b/go.mod index ae542d72758f6..eb899ac6cfa2a 100644 --- a/go.mod +++ b/go.mod @@ -348,6 +348,3 @@ replace ( k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.29.6 k8s.io/sample-controller => k8s.io/sample-controller v0.29.6 ) - -// TODO:CR-26144: Remove alias -replace github.com/codefresh-io/octopus-argo => /Users/andrii/go/src/github.com/codefresh-io/octopus-argo diff --git a/pkg/sources_server_client/client.go b/pkg/sources_server_client/client.go index 39588e355a353..e8de200c93fd1 100644 --- a/pkg/sources_server_client/client.go +++ b/pkg/sources_server_client/client.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + netUrl "net/url" log "github.com/sirupsen/logrus" @@ -13,8 +14,8 @@ import ( ) type VersionPayload struct { - app *v1alpha1.Application - revision *string + App v1alpha1.Application `json:"app"` + Revision string `json:"revision"` } type DependenciesMap struct { @@ -37,7 +38,7 @@ type sourceServerClient struct { } type SourceServerClientInteface interface { - GetAppVersion(app *v1alpha1.Application, revisions *string) *AppVersionResult + GetAppVersion(app *v1alpha1.Application, revision *string) *AppVersionResult } func (c *sourceServerClient) sendRequest(method, url string, payload interface{}) ([]byte, error) { @@ -50,7 +51,8 @@ func (c *sourceServerClient) sendRequest(method, url string, payload interface{} } } - req, err := http.NewRequest(method, fmt.Sprintf("%s%s", c.clientConfig.BaseURL, url), bytes.NewBuffer(requestBody)) + fullURL, err := netUrl.JoinPath(c.clientConfig.BaseURL, url) + req, err := http.NewRequest(method, fullURL, bytes.NewBuffer(requestBody)) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } @@ -77,8 +79,8 @@ func (c *sourceServerClient) sendRequest(method, url string, payload interface{} return body, nil } -func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revisions *string) *AppVersionResult { - appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{app: app, revision: revision}) +func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revision *string) *AppVersionResult { + appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{App: *app, Revision: *revision}) if err != nil { log.Errorf("error getting app version: %v", err) return nil