Skip to content

Commit

Permalink
fix: Fix the format of the user-agent header (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
unfunco committed May 8, 2024
1 parent c284ec6 commit de05838
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ jobs:
- name: Update the version number
if: ${{ steps.release.outputs.prs_created == 'true' }}
run: |
git config pull.ff only
git checkout ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
git pull origin ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
version=$(jq -r '."."' .github/release-manifest.json)
version=${version#v}
sed -i '/const semanticVersion = \"v[0-9]*\.[0-9]*\.[0-9]*\"/cconst semanticVersion = \"v$version\"' version.go
sed -i '/const semanticVersion = \"[0-9]*\.[0-9]*\.[0-9]*\"/cconst semanticVersion = \"$version\"' version.go
git config --local user.name "David Letterman"
git config --local user.email "[email protected]"
git add version.go
Expand Down
4 changes: 2 additions & 2 deletions anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
const (
defaultAPIVersion = "2023-06-01"
defaultBaseURL = "https://api.anthropic.com/v1/"
defaultBaseUserAgent = "unfunco/anthropic-sdk-go"
defaultBaseUserAgent = "anthropic-sdk-go"
)

// Client manages communication with the Anthropic REST API.
Expand Down Expand Up @@ -77,7 +77,7 @@ func (c *Client) NewRequest(method, path string, body any) (*http.Request, error
}

req.Header.Set("anthropic-version", defaultAPIVersion)
req.Header.Set("user-agent", defaultBaseUserAgent+"@"+semanticVersion)
req.Header.Set("user-agent", defaultBaseUserAgent+"/"+semanticVersion)

if body != nil {
req.Header.Set("content-type", "application/json")
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package anthropic

// semanticVersion does not need to be updated manually.
// It is automatically updated by the release process.
const semanticVersion = "v0.1.0"
const semanticVersion = "0.1.0"

0 comments on commit de05838

Please sign in to comment.