@@ -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
1516type VersionPayload struct {
16- app * v1alpha1.Application
17- revision * string
17+ App v1alpha1.Application `json:"app"`
18+ Revision string `json:"revision"`
1819}
1920
2021type DependenciesMap struct {
@@ -37,7 +38,7 @@ type sourceServerClient struct {
3738}
3839
3940type SourceServerClientInteface interface {
40- GetAppVersion (app * v1alpha1.Application , revisions * string ) * AppVersionResult
41+ GetAppVersion (app * v1alpha1.Application , revision * string ) * AppVersionResult
4142}
4243
4344func (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