Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix the format of the user-agent header #23

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "48985810+david-letterman@users.noreply.github.com"
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"
Loading