fix: MiMo ASR 认证头改为 Authorization: Bearer #53
@@ -134,7 +134,7 @@ func (m *MiMoService) Recognize(ctx context.Context, audio []byte, opts Options)
|
|||||||
return "", fmt.Errorf("stt: create request: %w", err)
|
return "", fmt.Errorf("stt: create request: %w", err)
|
||||||
}
|
}
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
req.Header.Set("api-key", m.apiKey)
|
req.Header.Set("Authorization", "Bearer "+m.apiKey)
|
||||||
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ func newTestMiMoService(handler http.HandlerFunc) (*MiMoService, *httptest.Serve
|
|||||||
func TestMiMoService_Recognize_Success(t *testing.T) {
|
func TestMiMoService_Recognize_Success(t *testing.T) {
|
||||||
s, srv := newTestMiMoService(func(w http.ResponseWriter, r *http.Request) {
|
s, srv := newTestMiMoService(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// 验证请求
|
// 验证请求
|
||||||
if r.Header.Get("api-key") != "test-key" {
|
if r.Header.Get("Authorization") != "Bearer test-key" {
|
||||||
t.Errorf("expected api-key test-key, got %s", r.Header.Get("api-key"))
|
t.Errorf("expected Authorization Bearer test-key, got %s", r.Header.Get("Authorization"))
|
||||||
}
|
}
|
||||||
if r.URL.Path != "/chat/completions" {
|
if r.URL.Path != "/chat/completions" {
|
||||||
t.Errorf("expected path /chat/completions, got %s", r.URL.Path)
|
t.Errorf("expected path /chat/completions, got %s", r.URL.Path)
|
||||||
|
|||||||
Reference in New Issue
Block a user