Fix: go restful api tests (#17247)

This commit is contained in:
Lynn
2026-07-22 19:06:08 +08:00
committed by GitHub
parent 4d772a9365
commit 32ddf59ac6
5 changed files with 17 additions and 15 deletions

View File

@@ -105,7 +105,7 @@ func (h *MemoryHandler) CreateMemory(c *gin.Context) {
}
// Validate required field: name
if req.Name == "" {
if strings.TrimSpace(req.Name) == "" {
common.ResponseWithCodeData(c, common.CodeArgumentError, nil, "name is required")
return
}
@@ -892,8 +892,10 @@ func isArgumentError(msg string) bool {
// Define list of argument error prefixes
// Matches Python ArgumentException error messages
argumentErrorPrefixes := []string{
"memory name cannot be empty", // Memory name cannot be empty
"memory name cannot be empty", // Python: "Memory name cannot be empty or whitespace."
"name cannot be empty", // ValidateName trimmed-empty case
"memory name exceeds limit", // Memory name exceeds limit
"name length is", // ValidateName exceeds limit
"memory type must be a list", // memory_type must be a list
"memory type is not supported", // Unsupported memory_type
}