Skip to content

Commit

Permalink
Merge pull request #622 from CircleCI-Public/fix-context-client
Browse files Browse the repository at this point in the history
Update context-specific http client to have consistent headers
  • Loading branch information
aengelberg authored Aug 18, 2021
2 parents effcb62 + 9467595 commit da3388b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/context_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"net/url"
"strings"

"github.com/CircleCI-Public/circleci-cli/api/header"
"github.com/CircleCI-Public/circleci-cli/settings"
"github.com/CircleCI-Public/circleci-cli/version"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -475,6 +477,11 @@ func (c *ContextRestClient) newHTTPRequest(method, url string, body io.Reader) (
req.Header.Add("circle-token", c.token)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("User-Agent", version.UserAgent())
commandStr := header.GetCommandStr()
if commandStr != "" {
req.Header.Add("Circleci-Cli-Command", commandStr)
}
return req, nil
}

Expand Down

0 comments on commit da3388b

Please sign in to comment.