Test_MatchScheme() — fiber Function Reference
Architecture documentation for the Test_MatchScheme() function in utils_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD d24c4d27_a8de_6305_c502_139a6a432290["Test_MatchScheme()"] 31acac19_a947_56a9_0afe_d7291e6d45a1["utils_test.go"] d24c4d27_a8de_6305_c502_139a6a432290 -->|defined in| 31acac19_a947_56a9_0afe_d7291e6d45a1 style d24c4d27_a8de_6305_c502_139a6a432290 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cors/utils_test.go lines 58–83
func Test_MatchScheme(t *testing.T) {
testCases := []struct {
domain string
pattern string
expected bool
}{
{domain: "http://example.com", pattern: "http://example.com", expected: true}, // Exact match should work.
{domain: "https://example.com", pattern: "http://example.com", expected: false}, // Scheme mismatch should matter.
{domain: "http://example.com", pattern: "https://example.com", expected: false}, // Scheme mismatch should matter.
{domain: "http://example.com", pattern: "http://example.org", expected: true}, // Different domains should not matter.
{domain: "http://example.com", pattern: "http://example.com:8080", expected: true}, // Port should not matter.
{domain: "http://example.com:8080", pattern: "http://example.com", expected: true}, // Port should not matter.
{domain: "http://example.com:8080", pattern: "http://example.com:8081", expected: true}, // Different ports should not matter.
{domain: "http://localhost", pattern: "http://localhost", expected: true}, // Localhost should match.
{domain: "http://127.0.0.1", pattern: "http://127.0.0.1", expected: true}, // IPv4 address should match.
{domain: "http://[::1]", pattern: "http://[::1]", expected: true}, // IPv6 address should match.
}
for _, tc := range testCases {
result := matchScheme(tc.domain, tc.pattern)
if result != tc.expected {
t.Errorf("Expected matchScheme('%s', '%s') to be %v, but got %v", tc.domain, tc.pattern, tc.expected, result)
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_MatchScheme() do?
Test_MatchScheme() is a function in the fiber codebase, defined in middleware/cors/utils_test.go.
Where is Test_MatchScheme() defined?
Test_MatchScheme() is defined in middleware/cors/utils_test.go at line 58.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free