Commit 61dde00b authored by Roy Hadad's avatar Roy Hadad Committed by Dima Brusilovsky
Browse files

feat: DAT:3414 changed /cliIds/:cliId to x-cli-id header (#151)


* feat: changed /cliIds/:cliId to x-cli-id header

* fix: changed tag to staging in makefile

* refactor: changed headers to map literal

* refactor: changed map literal in test
Co-authored-by: default avatarRoy Hadad <roy@datree.io>
parent 635c65d6
Showing with 10 additions and 5 deletions
+10 -5
...@@ -438,6 +438,8 @@ func test_createEvaluation_success() *CreateEvaluationTestCase { ...@@ -438,6 +438,8 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
} }
func test_publishPolicies_success() *PublishPoliciesTestCase { func test_publishPolicies_success() *PublishPoliciesTestCase {
expectedPublishHeaders := map[string]string{"x-cli-id": "cli_id"}
requestPoliciesConfigurationArg := files.UnknownStruct{} requestPoliciesConfigurationArg := files.UnknownStruct{}
return &PublishPoliciesTestCase{ return &PublishPoliciesTestCase{
name: "success - publish policies", name: "success - publish policies",
...@@ -479,9 +481,9 @@ func test_publishPolicies_success() *PublishPoliciesTestCase { ...@@ -479,9 +481,9 @@ func test_publishPolicies_success() *PublishPoliciesTestCase {
headers map[string]string headers map[string]string
}{ }{
method: http.MethodPut, method: http.MethodPut,
uri: "/cli/policy/publish/cliIds/cli_id", uri: "/cli/policy/publish",
body: requestPoliciesConfigurationArg, body: requestPoliciesConfigurationArg,
headers: nil, headers: expectedPublishHeaders,
}, },
response: nil, response: nil,
}, },
...@@ -489,6 +491,8 @@ func test_publishPolicies_success() *PublishPoliciesTestCase { ...@@ -489,6 +491,8 @@ func test_publishPolicies_success() *PublishPoliciesTestCase {
} }
func test_publishPolicies_schemaError() *PublishPoliciesTestCase { func test_publishPolicies_schemaError() *PublishPoliciesTestCase {
expectedPublishHeaders := map[string]string{"x-cli-id": "cli_id"}
requestPoliciesConfigurationArg := files.UnknownStruct{} requestPoliciesConfigurationArg := files.UnknownStruct{}
return &PublishPoliciesTestCase{ return &PublishPoliciesTestCase{
name: "schema error - publish policies", name: "schema error - publish policies",
...@@ -530,9 +534,9 @@ func test_publishPolicies_schemaError() *PublishPoliciesTestCase { ...@@ -530,9 +534,9 @@ func test_publishPolicies_schemaError() *PublishPoliciesTestCase {
headers map[string]string headers map[string]string
}{ }{
method: http.MethodPut, method: http.MethodPut,
uri: "/cli/policy/publish/cliIds/cli_id", uri: "/cli/policy/publish",
body: requestPoliciesConfigurationArg, body: requestPoliciesConfigurationArg,
headers: nil, headers: expectedPublishHeaders,
}, },
response: errors.New("error from cli-service"), response: errors.New("error from cli-service"),
}, },
......
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
) )
func (c *CliClient) PublishPolicies(policiesConfiguration files.UnknownStruct, cliId string) error { func (c *CliClient) PublishPolicies(policiesConfiguration files.UnknownStruct, cliId string) error {
_, err := c.httpClient.Request(http.MethodPut, "/cli/policy/publish/cliIds/"+cliId, policiesConfiguration, nil) headers := map[string]string{"x-cli-id": cliId}
_, err := c.httpClient.Request(http.MethodPut, "/cli/policy/publish", policiesConfiguration, headers)
return err return err
} }
Supports Markdown
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