From 2e29858d74f46fd265884cd9373df011069a9659 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 12 Mar 2026 10:49:45 -0400 Subject: [PATCH] fix(openrouter): avoid brittle User-Agent assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 💘 Generated with Crush Assisted-by: Kimi K2.5 via Crush --- providers/openrouter/useragent_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/providers/openrouter/useragent_test.go b/providers/openrouter/useragent_test.go index eb8070bad710773d1ce8398a2aaa1b23bb4b9b44..14f1d17ff5b7bdf294184945896d89c1d73f7f8b 100644 --- a/providers/openrouter/useragent_test.go +++ b/providers/openrouter/useragent_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "net/http" "net/http/httptest" + "strings" "testing" "charm.land/fantasy" @@ -56,7 +57,7 @@ func TestUserAgent(t *testing.T) { _, _ = model.Generate(t.Context(), fantasy.Call{Prompt: prompt}) require.Len(t, *captured, 1) - assert.Equal(t, "OpenAI/Go 2.7.1", (*captured)[0]["User-Agent"]) + assert.True(t, strings.HasPrefix((*captured)[0]["User-Agent"], "OpenAI/Go")) }) t.Run("WithUserAgent wins over default", func(t *testing.T) {