Skip to content

Commit

Permalink
Fix: replace the HTTP request header Accept-Type with Accept (#784)
Browse files Browse the repository at this point in the history
Co-authored-by: threepipes <[email protected]>
Co-authored-by: corinnesollows <[email protected]> --just pulled in master
  • Loading branch information
threepipes and threepipes authored Sep 23, 2022
1 parent eec8fd6 commit 7587e2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (c *Client) NewRequest(method string, u *url.URL, payload interface{}) (req
}

req.Header.Set("Circle-Token", c.circleToken)
req.Header.Set("Accept-Type", "application/json")
req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", version.UserAgent())
commandStr := header.GetCommandStr()
if commandStr != "" {
Expand Down
6 changes: 3 additions & 3 deletions api/rest/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestClient_DoRequest(t *testing.T) {
assert.Check(t, cmp.Equal(fix.Method(), "PUT"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"Content-Length": {"20"},
"Content-Type": {"application/json"},
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestClient_DoRequest(t *testing.T) {
assert.Check(t, cmp.Equal(fix.Method(), http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestClient_DoRequest(t *testing.T) {
assert.Check(t, cmp.Equal(fix.Method(), http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down
18 changes: 9 additions & 9 deletions api/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestRunner_CreateResourceClass(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "POST"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"Content-Length": {"86"},
"Content-Type": {"application/json"},
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestRunner_GetResourceClassByName(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestRunner_GetResourceClassesByNamespace(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand All @@ -160,7 +160,7 @@ func TestRunner_DeleteResourceClass(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "DELETE"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand All @@ -180,7 +180,7 @@ func TestRunner_DeleteResourceClass_Force(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "DELETE"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestRunner_CreateToken(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "POST"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"Content-Length": {"80"},
"Content-Type": {"application/json"},
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestRunner_GetRunnerTokensByResourceClass(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand All @@ -325,7 +325,7 @@ func TestRunner_DeleteToken(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "DELETE"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down Expand Up @@ -413,7 +413,7 @@ func TestRunner_GetRunnerInstances_ByNamespace(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, http.MethodGet))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down

0 comments on commit 7587e2d

Please sign in to comment.