fix(anthropic): surface in-band stream error + Builder accumulation (R7c)

This commit is contained in:
sausheong committed 2026-06-13 12:48:10 +08:00
1 parent d0cd0989a9
commit 373e44b9c7
2 files changed
+26 -6

No files matched your search

+9
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
anthropic "github.com/anthropics/anthropic-sdk-go"
@@ -708,3 +709,11 @@ data: {"type":"message_stop"}
assert.Equal(t, "end_turn", done.StopReason)
assert.Empty(t, done.StopCategory)
}
func TestAnthropicInputAccumulation(t *testing.T) {
var b strings.Builder
for _, part := range []string{`{"a"`, `:1`, `}`} {
b.WriteString(part)
}
require.Equal(t, `{"a":1}`, b.String())
}