返回 DeepSeek-Reasonix
request_url_test.go
根目录 / internal / provider / openai / request_url_test.go
1 package openai
2
3 import (
4 "testing"
5
6 "reasonix/internal/provider"
7 )
8
9 func TestNewPrefersExactRequestURLOverLegacyChatURL(t *testing.T) {
10 p, err := New(provider.Config{
11 BaseURL: "https://base.example.com/v1",
12 Model: "model-a",
13 Extra: map[string]any{
14 "chat_url": "https://legacy.example.com/chat/completions/",
15 "request_url": "https://exact.example.com/custom/?token=1",
16 },
17 })
18 if err != nil {
19 t.Fatalf("New: %v", err)
20 }
21 if got := p.(*client).chatURL; got != "https://exact.example.com/custom/?token=1" {
22 t.Fatalf("chatURL = %q, want exact request_url", got)
23 }
24 }
25
25 lines GO