diff --git a/pkg/funcspec/function_api_test.go b/pkg/funcspec/function_api_test.go index 39f6076..f8ece7d 100644 --- a/pkg/funcspec/function_api_test.go +++ b/pkg/funcspec/function_api_test.go @@ -821,7 +821,7 @@ func TestReplaceMetaVariables(t *testing.T) { name: "Replace [user]", sqlQuery: "SELECT * FROM audit WHERE username = [user]", expectedCheck: func(result string) bool { - return strings.Contains(result, "'testuser'") + return strings.Contains(result, "$USR$testuser$USR$") }, }, { diff --git a/pkg/restheadspec/headers.go b/pkg/restheadspec/headers.go index fb19255..c347850 100644 --- a/pkg/restheadspec/headers.go +++ b/pkg/restheadspec/headers.go @@ -8,6 +8,7 @@ import ( "regexp" "strconv" "strings" + "unicode/utf8" "github.com/bitechdev/ResolveSpec/pkg/common" "github.com/bitechdev/ResolveSpec/pkg/logger" @@ -103,7 +104,7 @@ func DecodeParam(pStr string) (string, error) { code, _ = DecodeParam(code) } else { strDat, err := base64.StdEncoding.DecodeString(code) - if err == nil { + if err == nil && utf8.Valid(strDat) { code = string(strDat) } }