Skip to content

Commit 3465724

Browse files
committed
dont change root function
1 parent a13543f commit 3465724

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

apptrust/http/http_client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type ApptrustHttpClient interface {
2525
GetHttpClient() *jfroghttpclient.JfrogHttpClient
2626
Post(path string, requestBody interface{}, params map[string]string) (resp *http.Response, body []byte, err error)
2727
Get(path string) (resp *http.Response, body []byte, err error)
28-
Patch(path string, requestBody interface{}, params map[string]string) (resp *http.Response, body []byte, err error)
28+
Patch(path string, requestBody interface{}) (resp *http.Response, body []byte, err error)
2929
Delete(path string) (resp *http.Response, body []byte, err error)
3030
}
3131

@@ -112,8 +112,8 @@ func (c *apptrustHttpClient) Get(path string) (resp *http.Response, body []byte,
112112
return response, body, err
113113
}
114114

115-
func (c *apptrustHttpClient) Patch(path string, requestBody interface{}, params map[string]string) (resp *http.Response, body []byte, err error) {
116-
url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, params)
115+
func (c *apptrustHttpClient) Patch(path string, requestBody interface{}) (resp *http.Response, body []byte, err error) {
116+
url, err := utils.BuildUrl(c.serverDetails.Url, apptrustApiPath+path, nil)
117117
if err != nil {
118118
return nil, nil, err
119119
}

apptrust/service/applications/application_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (as *applicationService) CreateApplication(ctx service.Context, requestBody
4242

4343
func (as *applicationService) UpdateApplication(ctx service.Context, requestBody *model.AppDescriptor) error {
4444
endpoint := fmt.Sprintf("/v1/applications/%s", requestBody.ApplicationKey)
45-
response, responseBody, err := ctx.GetHttpClient().Patch(endpoint, requestBody, nil)
45+
response, responseBody, err := ctx.GetHttpClient().Patch(endpoint, requestBody)
4646
if err != nil {
4747
return err
4848
}

apptrust/service/versions/version_service.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ func (vs *versionService) ReleaseAppVersion(ctx service.Context, applicationKey,
7777
}
7878

7979
func (vs *versionService) RollbackAppVersion(ctx service.Context, applicationKey, version string, request *model.RollbackAppVersionRequest) error {
80-
endpoint := fmt.Sprintf("/v1/applications/%s/versions/%s/rollback", applicationKey, version)
81-
response, responseBody, err := ctx.GetHttpClient().Post(endpoint, request, map[string]string{"async": "false"})
80+
endpoint := fmt.Sprintf("/v1/applications/%s/versions/%s/rollback?async=false", applicationKey, version)
81+
response, responseBody, err := ctx.GetHttpClient().Post(endpoint, request, map[string]string{})
8282
if err != nil {
8383
return err
8484
}
@@ -108,8 +108,8 @@ func (vs *versionService) DeleteAppVersion(ctx service.Context, applicationKey,
108108
}
109109

110110
func (vs *versionService) UpdateAppVersion(ctx service.Context, applicationKey string, version string, request *model.UpdateAppVersionRequest) error {
111-
endpoint := fmt.Sprintf("/v1/applications/%s/versions/%s", applicationKey, version)
112-
response, responseBody, err := ctx.GetHttpClient().Patch(endpoint, request, map[string]string{"async": "false"})
111+
endpoint := fmt.Sprintf("/v1/applications/%s/versions/%s?async=false", applicationKey, version)
112+
response, responseBody, err := ctx.GetHttpClient().Patch(endpoint, request)
113113
if err != nil {
114114
return err
115115
}

apptrust/service/versions/version_service_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func TestUpdateAppVersion(t *testing.T) {
397397
for _, tt := range tests {
398398
t.Run(tt.name, func(t *testing.T) {
399399
mockHttpClient := mockhttp.NewMockApptrustHttpClient(ctrl)
400-
mockHttpClient.EXPECT().Patch("/v1/applications/test-app/versions/1.0.0", tt.request, map[string]string{"async": "false"}).
400+
mockHttpClient.EXPECT().Patch("/v1/applications/test-app/versions/1.0.0?async=false", tt.request).
401401
Return(tt.mockResponse, []byte(tt.mockResponseBody), tt.mockError).Times(1)
402402

403403
mockCtx := mockservice.NewMockContext(ctrl)
@@ -466,8 +466,8 @@ func TestRollbackAppVersion(t *testing.T) {
466466
mockClient := mockhttp.NewMockApptrustHttpClient(ctrl)
467467
mockCtx.EXPECT().GetHttpClient().Return(mockClient)
468468

469-
expectedEndpoint := "/v1/applications/" + tt.applicationKey + "/versions/" + tt.version + "/rollback"
470-
mockClient.EXPECT().Post(expectedEndpoint, tt.payload, map[string]string{"async": "false"}).
469+
expectedEndpoint := "/v1/applications/" + tt.applicationKey + "/versions/" + tt.version + "/rollback?async=false"
470+
mockClient.EXPECT().Post(expectedEndpoint, tt.payload, map[string]string{}).
471471
Return(&http.Response{StatusCode: tt.expectedStatus}, []byte(""), nil)
472472

473473
service := NewVersionService()

0 commit comments

Comments
 (0)