Skip to content

Commit

Permalink
fix custom header by prefixing it with X-
Browse files Browse the repository at this point in the history
  • Loading branch information
qboileau authored Apr 22, 2024
1 parent d96e740 commit 8bcb51e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Client struct {
}

func Make(token string, baseUrl string, debug bool, key, cert string) (*Client, error) {
restyClient := resty.New().SetDebug(debug).SetHeader("Authorization", "Bearer "+token).SetHeader("CDK-CLIENT", "CLI/"+utils.GetConduktorVersion())
restyClient := resty.New().SetDebug(debug).SetHeader("Authorization", "Bearer "+token).SetHeader("X-CDK-CLIENT", "CLI/"+utils.GetConduktorVersion())
if (key == "" && cert != "") || (key != "" && cert == "") {
return nil, fmt.Errorf("key and cert must be provided together")
} else if key != "" && cert != "" {
Expand Down
8 changes: 4 additions & 4 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestApplyShouldWork(t *testing.T) {
"http://baseUrl/public/v1/topic",
nil,
httpmock.HeaderIs("Authorization", "Bearer "+token).
And(httpmock.HeaderIs("CDK-CLIENT", "CLI/unknown")).
And(httpmock.HeaderIs("X-CDK-CLIENT", "CLI/unknown")).
And(httpmock.BodyContainsBytes(topic.Json)),
responder,
)
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestGetShouldWork(t *testing.T) {
"http://baseUrl/public/v1/application",
nil,
httpmock.HeaderIs("Authorization", "Bearer "+token).
And(httpmock.HeaderIs("CDK-CLIENT", "CLI/unknown")),
And(httpmock.HeaderIs("X-CDK-CLIENT", "CLI/unknown")),
responder,
)

Expand Down Expand Up @@ -265,7 +265,7 @@ func TestDescribeShouldWork(t *testing.T) {
"http://baseUrl/public/v1/application/yo",
nil,
httpmock.HeaderIs("Authorization", "Bearer "+token).
And(httpmock.HeaderIs("CDK-CLIENT", "CLI/unknown")),
And(httpmock.HeaderIs("X-CDK-CLIENT", "CLI/unknown")),
responder,
)

Expand Down Expand Up @@ -326,7 +326,7 @@ func TestDeleteShouldWork(t *testing.T) {
"http://baseUrl/public/v1/application/yo",
nil,
httpmock.HeaderIs("Authorization", "Bearer "+token).
And(httpmock.HeaderIs("CDK-CLIENT", "CLI/unknown")),
And(httpmock.HeaderIs("X-CDK-CLIENT", "CLI/unknown")),
responder,
)

Expand Down

0 comments on commit 8bcb51e

Please sign in to comment.