Home / Function/ Test_Utils_ParamsMatch() — fiber Function Reference

Test_Utils_ParamsMatch() — fiber Function Reference

Architecture documentation for the Test_Utils_ParamsMatch() function in helpers_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  0fd73a19_8af2_ce71_6698_893da2bbb4e5["Test_Utils_ParamsMatch()"]
  c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"]
  0fd73a19_8af2_ce71_6698_893da2bbb4e5 -->|defined in| c82e3595_b1b8_f596_c097_f26fa40159d1
  style 0fd73a19_8af2_ce71_6698_893da2bbb4e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

helpers_test.go lines 323–371

func Test_Utils_ParamsMatch(t *testing.T) {
	testCases := []struct {
		description string
		accept      headerParams
		offer       string
		match       bool
	}{
		{
			description: "empty accept and offer",
			accept:      nil,
			offer:       "",
			match:       true,
		},
		{
			description: "accept is empty, offer has params",
			accept:      make(headerParams),
			offer:       ";foo=bar",
			match:       true,
		},
		{
			description: "offer is empty, accept has params",
			accept:      headerParams{"foo": []byte("bar")},
			offer:       "",
			match:       false,
		},
		{
			description: "accept has extra parameters",
			accept:      headerParams{"foo": []byte("bar"), "a": []byte("1")},
			offer:       ";foo=bar",
			match:       false,
		},
		{
			description: "matches regardless of order",
			accept:      headerParams{"b": []byte("2"), "a": []byte("1")},
			offer:       ";b=2;a=1",
			match:       true,
		},
		{
			description: "case-insensitive",
			accept:      headerParams{"ParaM": []byte("FoO")},
			offer:       ";pAram=foO",
			match:       true,
		},
	}

	for _, tc := range testCases {
		require.Equal(t, tc.match, paramsMatch(tc.accept, tc.offer), tc.description)
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_Utils_ParamsMatch() do?
Test_Utils_ParamsMatch() is a function in the fiber codebase, defined in helpers_test.go.
Where is Test_Utils_ParamsMatch() defined?
Test_Utils_ParamsMatch() is defined in helpers_test.go at line 323.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free