Skip to content

Commit fc0addc

Browse files
fix PR comments
1 parent c06ce89 commit fc0addc

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,3 @@ replace (
348348
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.29.6
349349
k8s.io/sample-controller => k8s.io/sample-controller v0.29.6
350350
)
351-
352-
// TODO:CR-26144: Remove alias
353-
replace github.com/codefresh-io/octopus-argo => /Users/andrii/go/src/github.com/codefresh-io/octopus-argo

pkg/sources_server_client/client.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66
"fmt"
77
"io"
88
"net/http"
9+
netUrl "net/url"
910

1011
log "github.com/sirupsen/logrus"
1112

1213
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1314
)
1415

1516
type VersionPayload struct {
16-
app *v1alpha1.Application
17-
revision *string
17+
App v1alpha1.Application `json:"app"`
18+
Revision string `json:"revision"`
1819
}
1920

2021
type DependenciesMap struct {
@@ -37,7 +38,7 @@ type sourceServerClient struct {
3738
}
3839

3940
type SourceServerClientInteface interface {
40-
GetAppVersion(app *v1alpha1.Application, revisions *string) *AppVersionResult
41+
GetAppVersion(app *v1alpha1.Application, revision *string) *AppVersionResult
4142
}
4243

4344
func (c *sourceServerClient) sendRequest(method, url string, payload interface{}) ([]byte, error) {
@@ -50,7 +51,8 @@ func (c *sourceServerClient) sendRequest(method, url string, payload interface{}
5051
}
5152
}
5253

53-
req, err := http.NewRequest(method, fmt.Sprintf("%s%s", c.clientConfig.BaseURL, url), bytes.NewBuffer(requestBody))
54+
fullURL, err := netUrl.JoinPath(c.clientConfig.BaseURL, url)
55+
req, err := http.NewRequest(method, fullURL, bytes.NewBuffer(requestBody))
5456
if err != nil {
5557
return nil, fmt.Errorf("error creating request: %w", err)
5658
}
@@ -77,8 +79,8 @@ func (c *sourceServerClient) sendRequest(method, url string, payload interface{}
7779
return body, nil
7880
}
7981

80-
func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revisions *string) *AppVersionResult {
81-
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{app: app, revision: revision})
82+
func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revision *string) *AppVersionResult {
83+
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{App: *app, Revision: *revision})
8284
if err != nil {
8385
log.Errorf("error getting app version: %v", err)
8486
return nil

0 commit comments

Comments
 (0)