Commit Graph

4 Commits

Author SHA1 Message Date
ParthSareen fceafefdce anthropic: fix ToolCallFunctionArguments type after rebase
Update tests and implementation to use the new ordered map-based
ToolCallFunctionArguments type which replaces the previous map[string]any.

- Add mapToArgs helper to convert map[string]any to ToolCallFunctionArguments
- Add testArgs and testProps helpers in tests
- Use cmpopts.IgnoreUnexported for cmp.Diff comparisons
2026-01-05 21:50:50 -08:00
ParthSareen bd4ab011ac middleware: use HTTP status code for Anthropic error mapping
Use w.ResponseWriter.Status() instead of parsing StatusCode from JSON
payload. routes.go typically sends errors as gin.H{"error": "..."}
without a StatusCode field, causing all errors to be mapped to
"api_error" instead of the appropriate type (not_found_error,
invalid_request_error, etc.).

Added tests to verify error handling for common routes.go patterns.
2026-01-05 19:19:34 -08:00
ParthSareen 9c27c72952 middleware: fix test for pointer type Text field 2026-01-05 19:19:34 -08:00
ParthSareen 6229df5b90 anthropic: add unit and integration tests
- Unit tests for transformation functions (FromMessagesRequest, ToMessagesResponse)
- Unit tests for error handling and edge cases
- Middleware integration tests with httptest
- Fix lint issues (gofmt)
- Fix unused struct fields in StreamConverter
- Add fallback for crypto/rand errors
2026-01-05 19:19:34 -08:00