MCPcopy
hub / github.com/gofiber/fiber / Test_Domain_Security_ValidParamNames

Function Test_Domain_Security_ValidParamNames

domain_test.go:1750–1771  ·  view source on GitHub ↗

Test_Domain_Security_ValidParamNames tests that valid parameter names are accepted

(t *testing.T)

Source from the content-addressed store, hash-verified

1748
1749// Test_Domain_Security_ValidParamNames tests that valid parameter names are accepted
1750func Test_Domain_Security_ValidParamNames(t *testing.T) {
1751 t.Parallel()
1752
1753 tests := []struct {
1754 name string
1755 pattern string
1756 }{
1757 {name: "alphanumeric", pattern: ":user123.example.com"},
1758 {name: "underscore", pattern: ":user_name.example.com"},
1759 {name: "hyphen", pattern: ":user-name.example.com"},
1760 {name: "mixed", pattern: ":user_123-name.example.com"},
1761 }
1762
1763 for _, tt := range tests {
1764 t.Run(tt.name, func(t *testing.T) {
1765 t.Parallel()
1766 require.NotPanics(t, func() {
1767 parseDomainPattern(tt.pattern)
1768 })
1769 })
1770 }
1771}
1772
1773// Test_Domain_Security_NonASCIIRejected tests that non-ASCII characters are rejected
1774// in both domain labels and parameter names (DNS names are ASCII-only).

Callers

nothing calls this directly

Calls 1

parseDomainPatternFunction · 0.85

Tested by

no test coverage detected