fixed linting issues
Signed-off-by: Sparsh <sparsh.raj30@gmail.com>
This commit is contained in:
parent
812ece9471
commit
c0784b916c
|
|
@ -2396,7 +2396,7 @@ func Test_buildRoutesAllowlist(t *testing.T) {
|
||||||
shouldError: false,
|
shouldError: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Mixed method and domain routes",
|
name: "Mixed method and domain routes",
|
||||||
skipAuthRegex: []string{},
|
skipAuthRegex: []string{},
|
||||||
skipAuthRoutes: []string{
|
skipAuthRoutes: []string{
|
||||||
"GET=^/api/v1",
|
"GET=^/api/v1",
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,8 @@ func validateAuthRoutes(o *options.Options) []string {
|
||||||
if len(parts) == 1 {
|
if len(parts) == 1 {
|
||||||
regex = parts[0]
|
regex = parts[0]
|
||||||
} else {
|
} else {
|
||||||
// Check if this is a domain-based route
|
// For method or domain-based routes, validate the regex
|
||||||
prefix := strings.ToLower(parts[0])
|
regex = parts[1]
|
||||||
if prefix == "domain" {
|
|
||||||
// For domain routes, validate the domain regex
|
|
||||||
regex = parts[1]
|
|
||||||
} else {
|
|
||||||
// For method-based routes, validate the path regex
|
|
||||||
regex = parts[1]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_, err := regexp.Compile(regex)
|
_, err := regexp.Compile(regex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue