feat: add Anthropic API support with custom version header (#934)
* feat: add Anthropic API support with custom version header * refactor: use switch statement for API type header handling * refactor: add OpenAI & AzureAD types to be exhaustive * Update client.go need explicit fallthrough in empty case statements * constant for APIVersion; addtl tests
This commit is contained in:
@@ -39,6 +39,21 @@ func TestClient(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetCommonHeadersAnthropic(t *testing.T) {
|
||||
config := DefaultAnthropicConfig("mock-token", "")
|
||||
client := NewClientWithConfig(config)
|
||||
req, err := http.NewRequest("GET", "http://example.com", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create request: %v", err)
|
||||
}
|
||||
|
||||
client.setCommonHeaders(req)
|
||||
|
||||
if got := req.Header.Get("anthropic-version"); got != AnthropicAPIVersion {
|
||||
t.Errorf("Expected anthropic-version header to be %q, got %q", AnthropicAPIVersion, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeResponse(t *testing.T) {
|
||||
stringInput := ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user