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

Function Test_normalizeSchemeHost

internal/schemehost/schemehost_test.go:79–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func Test_normalizeSchemeHost(t *testing.T) {
80 t.Parallel()
81 testCases := []struct {
82 name, scheme, host, expectedHost string
83 }{
84 {"http default port added", "http", "example.com", "example.com:80"},
85 {"https default port added", "https", "example.com", "example.com:443"},
86 {"http custom port preserved", "http", "example.com:8080", "example.com:8080"},
87 {"https ipv6 default port added", "https", "[::1]", "[::1]:443"},
88 {"unknown scheme preserved", "ftp", "example.com", "example.com"},
89 {"https ipv6 custom port preserved", "https", "[::1]:8080", "[::1]:8080"},
90 }
91 for _, tc := range testCases {
92 t.Run(tc.name, func(t *testing.T) {
93 t.Parallel()
94 assert.Equal(t, tc.expectedHost, normalizeSchemeHost(tc.scheme, tc.host))
95 })
96 }
97}
98
99func Test_Match(t *testing.T) {
100 t.Parallel()

Callers

nothing calls this directly

Calls 1

normalizeSchemeHostFunction · 0.85

Tested by

no test coverage detected