adding test case

This commit is contained in:
Mzack9999
2025-11-18 21:43:28 +04:00
parent 8c560523e3
commit 9b37f1b441
3 changed files with 46 additions and 38 deletions

View File

@@ -778,7 +778,14 @@ func (request *Request) Type() templateTypes.ProtocolType {
func (request *Request) getPorts() []string {
for k, v := range request.Args {
if strings.EqualFold(k, "Port") {
ports := types.ToStringSlice(strings.Split(types.ToString(v), ","))
portStr := types.ToString(v)
ports := []string{}
for _, p := range strings.Split(portStr, ",") {
trimmed := strings.TrimSpace(p)
if trimmed != "" {
ports = append(ports, trimmed)
}
}
return sliceutil.Dedupe(ports)
}
}