feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,45 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/relaykit/types"
|
||||
)
|
||||
|
||||
func TestClientFacingOpenAIErrorHidesUpstreamDetails(t *testing.T) {
|
||||
err := types.NewOpenAIError(errors.New("provider.example.invalid provider secret failure"), types.ErrorCodeBadResponseStatusCode, http.StatusBadGateway)
|
||||
got := clientFacingOpenAIError(err, true, "local-request-id")
|
||||
|
||||
if strings.Contains(got.Message, "example-provider") || strings.Contains(got.Message, "provider secret") {
|
||||
t.Fatalf("upstream details leaked: %q", got.Message)
|
||||
}
|
||||
if !strings.Contains(got.Message, "local-request-id") {
|
||||
t.Fatalf("local request id missing: %q", got.Message)
|
||||
}
|
||||
if got.Code != "model_service_error" {
|
||||
t.Fatalf("unexpected public code: %v", got.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientFacingClaudeErrorHidesUpstreamDetails(t *testing.T) {
|
||||
err := types.NewOpenAIError(errors.New("provider.example.invalid provider secret failure"), types.ErrorCodeBadResponseStatusCode, http.StatusBadGateway)
|
||||
got := clientFacingClaudeError(err, true, "local-request-id")
|
||||
|
||||
if strings.Contains(got.Message, "example-provider") || strings.Contains(got.Message, "provider secret") {
|
||||
t.Fatalf("upstream details leaked: %q", got.Message)
|
||||
}
|
||||
if !strings.Contains(got.Message, "local-request-id") {
|
||||
t.Fatalf("local request id missing: %q", got.Message)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientFacingErrorKeepsLocalValidationMessage(t *testing.T) {
|
||||
err := types.NewErrorWithStatusCode(errors.New("model is required"), types.ErrorCodeInvalidRequest, http.StatusBadRequest)
|
||||
got := clientFacingOpenAIError(err, false, "local-request-id")
|
||||
if !strings.Contains(got.Message, "model is required") {
|
||||
t.Fatalf("local validation message was hidden: %q", got.Message)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user